6.4 Accidental Complexity In Languages That Do Not Support Multiple Inheritance
What would happen to our design if we were forced to implement it solely with single inheritance? It would look like the model in Figure 6.5.
Figure 6.5. A single-inheritance WoodenDoor.
The designer is forced to contain all but one of the base classes and must provide delegation functions to these containing classes. The problem with this design is that when we add a new operation to the WoodenObject class, we must scan our design for any class that contains WoodenObject and check to see if it is true containment or simply pseudo-inheritance. If it is pseudo-inheritance, we must add a delegation function to the containing class which simply calls the function on the contained Woodenobject. This would fall under Frederick Brook's idea of accidental complexity (see Section 1.2). If a developer does not have multiple inheritance at his or her disposal, he or she will get accidental complexity for these types of designs. Multiple inheritance, therefore, adds expressive power to the languages that implement it.