DEV Community

Discussion on: What's so bad about inheritance in comparison to composition?

Collapse
 
frau2015 profile image
skal • Edited

Inheritance in a class based system, everything is inherited from child to parent. If you have one branch of classes you can't brach to another one, which is bad about inheritance. You can't make new connections to other hierarchies, so if you decide that one class should also inherent from another class from a different hierarchy than you'll have to make a new design will includes that other class in your classes hierarchy. This in flexibility gets annoying and difficult to mange on large systems maybe its okay if you writing small projects