6.5 Frameworks That Incorporate Multiple Inheritance
Consider a modification to our notion of WoodenDoor, where we take into consideration the fact that doors have a body of some material (e.g., wood, steel, plastic), hinges of some material (e.g., brass, steel, gold), an optional window of some material (glass, plastic, Plexiglass), and a door knob of some material (e.g., steel, brass, wood). This implies that there is only one door class, but it is implemented as a framework (see Figure 6.6). The multiple inheritance is simply pushed down into the framework of the door.
Figure 6.6. A framework for doors.
Like all frameworks, this framework captures information relevant to the design of doors as well as the code that implements doors. By adding a new derived class to one of the contained base classes, we create the possibility for a number of different object constructions. For example, by adding a steel hinge to our domain, we create the possibility of having wooden doors with steel hinges, steel doors with steel hinges, etc.