Container Classes
The previous section discussed a number of special cases for composite class data members that you are not likely to use every day. This section discusses a number of special cases for composite class data members that you are going to use very often. Even if you will not be writing similar classes yourself, you are going to use container classes written by others. Container classes are a special case of composite classes, which are useful when the application needs a data type that contains a dynamic collection of values. Almost any application needs one (or more).
Even the first examples of class composition that I discussed in this chapter (e.g., class Rectangle) contained a collection of components, in this case, objects ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access