What are the drawbacks of inheritance?

What are the drawbacks of inheritance?

Drawbacks of inheritance :
    * Difficulty of understanding complex hierarchy.
    * Makes writing a compiler harder, e.g. requires more dynamic type checking since type of an object can change during runtime.
    * Adversely affects execution speed, program size, program complexity, and incurs method passing overhead.
    * Inheritance forces a set of methods and fields on a class. You may not want some of these, and it is not necessary that all of these are required. There is no concept of partial inheritance. 
    * Interface stability of base classes sometimes require even more complexity.

By:Jalees
Date:2016-01-09 00:00:00

Post Your Answers


User Email:

User Name:
Answers:

Related Java Subjective Links

Java Subjective interview questions and answers for experienced and fresher