O'Reilly logo

Navigating C++ and Object-Oriented Design by Gail Anderson, Paul Anderson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

5.8. Friend Classes

Many objects require more than one class to implement their inside and outside views. In this situation, multiple classes must somehow work together to provide access to what one class needs from another. What is the proper way to design these classes? To investigate, let's create a List class (a linked list data structure) that stores character strings. This initial design of List is the basis for improved versions that appear in subsequent chapters. A second class (Node) provides some of the implementation for the List class. Figure 5.2 shows the arrangement.

Figure 5.2. List and Node classes

Node objects contain pointers ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required