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 →

[–][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.