inheritance
The theory behind inheritance is that the world is best represented by a hierarchy
this hierarchy will help with code reuse
When to use
When not create wide or deep object hierachies
Ideally, should have one level where subclasses are the leafs of the superclass
Why bad?
leads to more brittle systems and defects
told to favour composition over inheritance as getting inheritance correct is difficult
A lot of patterns were created to overcome the usage of inheritance
https://www.yegor256.com/2016/09/13/inheritance-is-procedural.html
Last updated
Was this helpful?