1.

Explain The Concept Of Multiple Inheritance (virtual Inheritance). Write About Its Advantages And Disadvantages?

Answer»

Multiple inheritance is defined as the ability of a derived class to inherit the characteristics of more than one base class. For example, you MIGHT have a class zoo which inherits VARIOUS animal classes. The advantage of multiple inheritance is that you can create a single derived class from several base classes. It HELPS in understanding the logic behind these complex relationships.

The multiple inheritance is not preferred by the programmers because with multiple base classes, there are chances of conflicts while calling a method in the sub class that exists in both the base classes. For example, if you have a class NAMED zoo that inherits both the Anaconda and Zebra classes, then each base class might define a different version of the method walk, which creates a CONFLICTING situation.

Multiple inheritance is defined as the ability of a derived class to inherit the characteristics of more than one base class. For example, you might have a class zoo which inherits various animal classes. The advantage of multiple inheritance is that you can create a single derived class from several base classes. It helps in understanding the logic behind these complex relationships.

The multiple inheritance is not preferred by the programmers because with multiple base classes, there are chances of conflicts while calling a method in the sub class that exists in both the base classes. For example, if you have a class named zoo that inherits both the Anaconda and Zebra classes, then each base class might define a different version of the method walk, which creates a conflicting situation.



Discussion

No Comment Found