dvantages 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.
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 support direct multiple inheritance. You can implement partial multiple inheritance using interfaces. ex: public class ExMultInherit implements interface1, interface2, interface 3 { ... .... ...... }
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.
The advantages of multiple inheritance over single inheritance include being a realistic software model. It is useful in breaking down complicated behavior into sets of characteristics that does not interfere with one another.
The advantages of UML includes the ability to be used to model most types of applications and also generate test scripts apart from stub code. The biggest disadvantage of UML, is that it does not define a standard file format, which places limitations on the software capabilities.
Java does not support multiple inheritance
UML supports Object Oriented Analysis and Design (OOAD). It has all related concepts like classes, objects, inheritance, encapsulation, polymorphism, etc. UML is most suitable for use case driven, iterative and incremental development processes as most OOAD processes are.
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.
Java does not support direct multiple inheritance. You can implement partial multiple inheritance using interfaces. ex: public class ExMultInherit implements interface1, interface2, interface 3 { ... .... ...... }
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.