What Have You Learned, Dorothy?

“If I ever go looking for my heart's desire again, I won't look any further than my own backyard.” While it is true there is no place like home, it is also true that this is nothing like procedural programming. In procedural programming, a controlling method would examine data and invoke functions.

In this object-oriented approach, each individual object is given a narrow and well-defined set of responsibilities. The linked list is responsible for maintaining the head node. The HeadNode immediately passes any new data on to whatever it currently points to, without regard for what that might be.

The TailNode, whenever it is handed data, creates a new node and inserts it. It knows only one thing: If this came to ...

Get Sams Teach Yourself C++ in 24 Hours, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.