Biology, asked by haritejavijapur8895, 1 year ago

list the merits of single inheritance over multiple inheritance

Answers

Answered by jatinnaik240516
4

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

Similar questions