Multiple Inheritance

Why Trust Techopedia

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.

Advertisements

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.

Advertisements

Related Terms

Margaret Rouse
Technology Expert
Margaret Rouse
Technology Expert

Margaret is an award-winning technical writer and teacher known for her ability to explain complex technical subjects to a non-technical business audience. Over the past twenty years, her IT definitions have been published by Que in an encyclopedia of technology terms and cited in articles by the New York Times, Time Magazine, USA Today, ZDNet, PC Magazine, and Discovery Magazine. She joined Techopedia in 2011. Margaret's idea of a fun day is helping IT and business professionals learn to speak each other’s highly specialized languages.