Don't miss an insight. Subscribe to Techopedia for free.


Multiple Inheritance

What Does Multiple Inheritance Mean?

Multiple inheritance a feature of some object-oriented programming languages in which a class or an object inherits characteristics and properties from more than one parent class or object. This is contrary to the single inheritance property, which allows an object or class to inherit from one specific object or class. Although there are certain benefits associated with multiple inheritance, it does increase ambiguity and complexity when not designed or implemented properly.


Techopedia Explains Multiple Inheritance

Unlike single inheritance, multiple inheritance has symmetrical merging and asymmetric extension from an inheritance perspective. When the characteristics of one set do not depend on the characteristics of the other set, multiple inheritance is likely to be more advantageous. In other words, multiple inheritance is more useful when the separation of characteristics of objects into orthogonal sets is possible. Multiple inheritance is useful in the case of an adapter pattern. It allows for one interface to be adapted by another. Another benefit of multiple inheritance is associated with the observer pattern. In this pattern, the calls can keep a list of functions/observers that can be notified by some change by calling one of the functions. Examples of programming languages which support multiple inheritance are C++, Python, Perl, Eiffel, Dylan, Curl, Eulisp and Tcl. Java is one of the most prominent programming languages which does not support multiple inheritance.

However, there are some drawbacks associated with multiple inheritance. The feature complicates the method dispatch and also brings additional scrutiny to the application. Multiple inheritance would need the awareness of dependencies, especially related to method selections. Moreover, protocols using multiple inheritance would need more documentation than those using single inheritance.


Related Terms