Because it can cause a lot of confusion, say when both the classes from which you want the child class to inherit from, has a method with same name and signature, the compiler will not know which method to choose. Between if you really want to implement multiple inheritance there are workarounds usigng interfaces, for which you can Google.
Multiple Inheritance is the process whereby a child can be derived from more than one parent class. The advantage of multiple inheritance is that it allows a class to inherit the functionality of more than one base class thus allowing for modeling of complex relationships. The disadvantage of multiple inheritance is that it can lead to a lot of confusion (ambiguity) when two base classes implement a method with the same name.
Advantages of multiple inheritances:
· Multiple inheritance allows a class to inherit the functionality of more than one base class thus allowing for modeling of complex relationships
· You categorize classes in many ways. Multiple inheritance is a way of showing our natural tendency to organize the world. During analysis, for example, we use multiple inheritance to capture the way users classify objects.
· By having multiple super-classes, your subclass has more opportunities to reuse the inherited attributes and operations of the super-classes.
Disadvantages of multiple inheritances:
· Some programming languages (such as Java) do not allow you to use multiple inheritances. You must translate multiple inheritance into single inheritance or individual java interfaces. This can be confusing and difficult to maintain because the implemented code for categorizing objects is quite different fro the way the user organizes those objects. So, when the user changes their mind or adds another category, it is difficult to figure out how to program the new sub classes.
· The more super classes your sub class inherits from the more maintenance you are likely to perform. If one of the super classes happens to change, the sub class may have to change as well.
· When a single sub class inherits the same attribute or operation form different super classes, you must choose exactly which one it must use.
Multiple inheritances can cause a lot of confusion, say when both the classes from which you want the child class to inherit from, has a method with same
Muhammad Shahbaz
Linux Administrator
Other Responses:
The Eiffel language and method was designed from the ground up to have multiple inheritance without ANY of the `gotchas' of languages like Java, C++ and others. The `disadvantages' listed above have nothing to do with MI, but with the technique and technologies listed (e.g. Java or C++). When MI is designed thoughtfully into a language and method, then the `dangers' or `disadvantages' are not there. As an Eiffel engineer, we use MI extensively, safely and beneficially all the time.
One of the main disadvantages of inheritance in Java (the same in other object-oriented languages) is the increased time/effort it takes the program to jump through all the levels of overloaded classes. If a given class has ten levels of abstraction above it, then it will essentially take ten jumps to run through a function defined in each of those classes (the toString method, for example).
The only real disadvantage of having multiple constructors is that it can increase code size unecessarily if certain constructors are actually redundant. However, multiple constructors are useful in that they make it easier for consumers to construct objects of your class in more than one way. All classes other than singleton classes should have at least two constructors anyway: a default constructor (with or without arguments) and a copy constructor. Overloading the default constructor with default values is often the best approach, but there is no real harm in creating multiple overloaded constructors if it makes it easier for consumers to construct objects from your class.
Java does not support direct multiple inheritance. You can implement partial multiple inheritance using interfaces. ex: public class ExMultInherit implements interface1, interface2, interface 3 { ... .... ...... }
Java does not support multiple inheritance. It is done with the help of interfaces in java. a class can implement n number of interfaces, thus showing multiple inheritance. but a class cannot extend multiple classes in java.
There are no drawbacks to multiple inheritance if multiple inheritance is precisely what is required to achieve your goal. If there are any drawbacks then it is only because of poor design, not multiple inheritance itself. For instance, when designing classes to simulate vehicles, an amphibious vehicle would inherit the properties of both an off-road vehicle and a marine vehicle, therefore multiple inheritance would be an appropriate usage.
There are only two types of inheritance to begin with: single inheritance and multiple inheritance. Since they are mutually exclusive there is no such thing as hybrid inheritance.
C++ allows multiple inheritance while Java does not. In my opinion, multiple inheritance is not useful because it can get very confusing very quick. For polymorphism, C++ does early binding by default, while Java does late binding by default. Late binding is more useful than early binding.
Java does not support direct multiple inheritance. You can implement partial multiple inheritance using interfaces. ex: public class ExMultInherit implements interface1, interface2, interface 3 { ... .... ...... }
Java does not support multiple inheritance
Single Inheritance Multiple Inheritance Multilevel Inheritance
Types of dominance, multiple alleles, sex linked inheritance, polygenic inheritance and maternal inheritance.
Java does not support multiple inheritance. It is done with the help of interfaces in java. a class can implement n number of interfaces, thus showing multiple inheritance. but a class cannot extend multiple classes in java.
Java does not allow the multiple inheritance of concrete classes, though it does allow a "hybrid" inheritance of one concrete class and multiple interfaces.
There are no drawbacks to multiple inheritance if multiple inheritance is precisely what is required to achieve your goal. If there are any drawbacks then it is only because of poor design, not multiple inheritance itself. For instance, when designing classes to simulate vehicles, an amphibious vehicle would inherit the properties of both an off-road vehicle and a marine vehicle, therefore multiple inheritance would be an appropriate usage.
C is not object-oriented -- you can't even use single inheritance let alone multiple inheritance.
Java does not support direct multiple Inheritance. Harder to implement, not every language support it: C++ does, Java does not.
Mendelian inheritance, multiple alleles.
The patrilineal inheritance system has several disadvantages, including: Gender Inequality Family Conflicts Disinherited Children Inefficient Resource Allocation Inflexibility
Actually, java does not support multiple inheritance. You can achieve partial multiple inheritance using interfaces but java is not like C or C++ where you can do direct multiple inheritance. However, you can achieve partial multiple inheritance with the help of interfaces. Ex: public class FerrariF12011 extends Ferrari implements Car, Automobile {…} And this is under the assumption that Car and Automobile are interfaces. Here if you see, though you don't inherit concrete code from the Car or the Automobile interface, you do inherit skeleton methods that determine the way your class eventually behaves and hence this can be considered partial Multiple Inheritance.