Summary

In this hour you learned about linked lists.

A linked list is a dynamically sized collection. Each data object is held in a node in the list. To get to a particular node, you must start at one end of the list and walk the list to the node you need.

You saw how to encapsulate limited functionality into each small class in the list and how these well-designed objects can work together synergistically. The node hierarchy uses inheritance to factor out common node methods such as Insert(). Nodes use virtual functions to allow you to treat the various kinds of Nodes polymorphically. For example, when you call Insert() you do not need to know if you are calling it on a head node, a tail node or an internal node.

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.