0 votes
in C Plus Plus by

What are Multiple Inheritances (virtual inheritance)? What are its advantages and disadvantages?

1 Answer

0 votes
by

In multiple inheritances, we have more than one base classes from which a derived class can inherit. Hence, a derived class takes the features and properties of more than one base class.

For Example, a class driver will have two base classes namely, employee and a person because a driver is an employee as well as a person. This is advantageous because the driver class can inherit the properties of the employee as well as the person class.

But in the case of an employee and a person, the class will have some properties in common. However, an ambiguous situation will arise as the driver class will not know the classes from which the common properties should be inherited. This is the major disadvantage of multiple inheritances.

Related questions

+1 vote
asked Oct 19, 2022 in C Plus Plus by AdilsonLima
0 votes
asked May 23, 2020 in Python by sharadyadav1986
...