Disadvantages of Inheritance
- You can't change the implementation provided by superclass at runtime. Inheritance is defined at compile time.
- Inheritance is said to "break encapsulation" by exposing a subclass to protected members of parent class
- Leads to child class being tightly coupled with parent class. Changes in parent class will lead to changes in subclass.
- Excessive deep inheritance trees can make inheritance stack very deep and confusing.
References
Prefer composition over inheritance? - Stack Overflow
Backlinks