3.8. Association
Whenever we create a class, such as Student or Professor, in which one or more of the fields are themselves references to other objects, we are employing an OO technique known as association. The number of levels to which objects can be conceptually bundled inside one another is endless, so association enables us to model very sophisticated real-world concepts. As it turns out, most "interesting" classes employ association.
With association, it may seem as if we're nesting objects one inside the other, as depicted in Figure 3-8.
Figure 3.8. Conceptual object "nesting"
Actual object nesting (that is, declaring one class inside ...
Get Beginning C# 2008 Objects: From Concept to Code 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.