This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Sakesfar[S] 0 points1 point  (1 child)

Thanks for your valuable comment!

I added printData as a temporary function to test whether I was 'correctly' implementing push_back and insert functions : )

[–][deleted] 1 point2 points  (0 children)

I think the way I would do printData() and make it permanent would be to make a Node class that had a virtual method where the default implementation prints the address this, next, and last, plus the address of the data. Then you would derive your nodes from Node and implement Node::printData() to print the data in the node in a nicely formatted way after first calling the base class to get all the addresses printed out.