Composition Relationships

We have already seen that composition represents a part of a whole. Although the inheritance relationship is stated in terms of is-a, composition is stated in terms of has-a. We know intuitively that a car “has-a” steering wheel (see Figure 9.2).


Figure 9.2. A composition relationship.

The reason to use composition is that it builds systems by combining less complex parts. This is a common way for ...

Get The Object-Oriented Thought Process, Fourth Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.