Home Segments Index Top Previous Next

Chapter 50:

How To Iterate over Lists using Iteration Class Objects

In Chapter 49, you learned how to reuse class definitions so that you can make lists out of any sort of object you like. As defined, however, traversing a list alters that list, because of the changes made to the current_link_pointer member variable. Such alteration is a problem if you ever need to have more than one traversal going simultaneously.

Accordingly, in this chapter, you learn about iteration classes, which allow you to separate list construction from list traversal, thereby enabling multiple simultaneous traversals.