Composition also provides encapsulation and reuse. Encapsulation is stronger in composition, because changes in one class are less likely to ripple throughout an object hierarchy. With inheritance, on the other hand, a change in a base class impacts every class in the hierarchy. Some languages don't provide for inheritance. Visual Basic is a prominent example.
Composition can substitute for inheritance generally, but the results are far from pretty.
Object models benefit from the thoughtful leveraging of both. Inheritance is clumsy and inefficient when objects transition from one type to another. Use composition when objects need to transmute from one subclass to another. Inheritance is appropriate when one class extends another class. In Part II, we'll take a look at abstract base classes and descendant classes, and why programming to the former is an essential aspect to object model design.