Multiple inheritance

In the object-oriented programming is multiple inheritance when a derived class inherits directly from more than one base class. A sequential, multi-stage heirs other hand, is not referred to as multiple inheritance.

An application example is the modeling of an amphibious vehicle, which also inherits the attributes of both a land vehicle of the watercraft. This amphibious vehicle has both a number and a draft wheels.

Few programming languages ​​offer the possibility of multiple - class inheritance, for example, C , CLOS, Eiffel, Perl, and Python. As an objection to multiple class inheritance is often referred to, that they can make the design unnecessarily complicated and opaque. So this can lead to ambiguities in the context of the Diamond problem. In some programming languages ​​, such as Oberon and its further developments, was therefore deliberately avoided the possibility of multiple implementation inheritance, which can be compensated by the use of twin classes.

In contrast, multiple interface inheritance is unproblematic. In Java, Object Pascal (Delphi ), C # and VB.NET can inherit many interfaces a class arbitrarily. This committed this class to provide the interface methods available, and thus represents something similar to the is-a relationship that relationship - is - like relationship, here.

With simple class inheritance and multiple interface inheritance most requirements for a software design can be realized, without having to accept the disadvantages of full multiple inheritance in purchasing.

561975
de