| Home | Previous Lesson: Inheriting the Interface Next Lesson: Benefits of Inheritance |
Inheritance hierarchies need not be limited to single inheritance. Multiple inheritance is complex to understand, but it follows the same principles as single inheritance. Multiple inheritance is a set of many-to-many parent/child relationships among the classes associated with objects. Multiple inheritance allows an object to inherit functionality from more than one object.
In the above example, the Ambulance class not only inherits functionality from the Car, but also from the Emergency class. It therefore gets all the features of an Emergency vehicle, together with those on offer from the Car.
Multiple inheritance is useful in situations where there are multiple groups of common characteristics, which partially overlap one another.
| Home | Previous Lesson: Inheriting the Interface Next Lesson: Benefits of Inheritance |