11. Composition
In this chapter we explore the composition of classes, where objects of one type contain references to objects of other types.
Whereas inheritance expresses the “is a” relationship between two classes, composition expresses the “has a” relationship.
In the first example, a PetOwner “has a” Pet object. In the second example, a CrazyPetOwner “has a” list of Pet objects.