What are the advantages of single inheritance over multiple inheritance?

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.
3 people found this useful
Thanks for the feedback!
Follow

Beautiful Goodbye is out! Can you tell our users why they should get a copy?

View Full Interview

Advantages of multiple inheritance in UML?

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 relati (MORE)

In Estates

What are the advantages of inheritance?

Advantages of Inheritance 1) Code Re-usability 2) consumes less time 3) Without changing the super class we can add some more methods in the super class by inheriting it in (MORE)

States With and Without Inheritance Tax

According to the popular quip, the only things certain in life are death and taxes. If you have ever received an inheritance from a deceased loved one, you know that, in some (MORE)

California Inheritance Tax

No matter where you live in the United States, you may eventually be required to pay taxes on money or property you inherit when someone close to you passes away and leaves yo (MORE)

Understanding Illinois Inheritance Tax

Unless you or someone you know has had a friend or family member that received a gift of money or property as part of the person's final wishes, then odds are that you may hav (MORE)

Advantages of single inheritance?

Some advantages are: a. The child class comfortably extends all behavior from its parent class b. There is no confusion about who the parent class of this class in the inher (MORE)

What are the advantages of single inheritance?

the advantage of single inheritance is code reusability, as one class can inherit the features of another other class. Presumably, the larger questions around the advantages o (MORE)

Difference between inheritance and multiple inheritance?

Inheritance enables new classes(child class) inherit the properties  and methods of existing classes(parent class). Multiple inheritance  refers OOP feature in which a child (MORE)

What is single inheritance and multi inheritance?

1. Single Inheritance    A Scenario where one class is inheriting/extending the behavior of  just one super class.    Ex: public class Ferrari extends Car {…}  (MORE)

In Taxes

Does Louisiana Have an Inheritance or Estate Tax?

If you are receiving part of an estate from someone who died, it may be subject to an inheritance tax. This is on state by state basis, as there is no federal one. If you are (MORE)

The Advantages of Keeping Just One Credit Card

How many credit cards do you have in your wallet? If you're like most consumers, there are between five and seven cards in there taking up space and tempting you to spend. Whi (MORE)