Computer Science, asked by junaid535, 1 year ago

Advantages and disadvantages of hybrid inheritance in c++

Answers

Answered by naveenkb
4
Advantages of inheritance are as follows:

Inheritance promotes reusability. When a class inherits or derives another class, it can access all the functionality of inherited class.

Reusability enhanced reliability. The base class code will be already tested and debugged.

As the existing code is reused, it leads to less development and maintenance costs.

Inheritance makes the sub classes follow a standard interface.

Inheritance helps to reduce code redundancy and supports code extensibility.

Inheritance facilitates creation of class libraries.

 

Disadvantages of inheritance are as follows:

Inherited functions work slower than normal function as there is indirection.

Improper use of inheritance may lead to wrong solutions.

Often, data members in the base class are left unused which may lead to memory wastage.

Inheritance increases the coupling between base class and derived class. A change in base class will affect all the child classes.

Answered by venkatavineela3
1

Answer:

Explanation:

Advantages of inheritance are as follows:

Inheritance promotes reusability. When a class inherits or derives another class, it can access all the functionality of inherited class.

Reusability enhanced reliability. The base class code will be already tested and debugged.

As the existing code is reused, it leads to less development and maintenance costs.

Inheritance makes the sub classes follow a standard interface.

Inheritance helps to reduce code redundancy and supports code extensibility.

Inheritance facilitates creation of class libraries.

 

Disadvantages of inheritance are as follows:

Inherited functions work slower than normal function as there is indirection.

Improper use of inheritance may lead to wrong solutions.

Often, data members in the base class are left unused which may lead to memory wastage.

Inheritance increases the coupling between base class and derived class. A change in base class will affect all the child classes.

Similar questions