Why do linked lists use pointers instead of storing nodes inside of nodes

后端 未结 11 2199
春和景丽
春和景丽 2020-12-07 13:53

I\'ve worked with linked lists before extensively in Java, but I\'m very new to C++. I was using this node class that was given to me in a project just fine

         


        
11条回答
  •  长情又很酷
    2020-12-07 14:18

    The latter (Node m_next) would have to contain the node. It wouldn't point to it. And there would then be no linking of elements.

提交回复
热议问题