DEV Community

Discussion on: Why composition is superior to inheritance as a way of sharing code

Collapse
 
jluisestrada profile image
JLuis Estrada

Obviously you can use inheritance the way you want. Is not restrictive at all other than a few rules that change from language to language.

But overall, that's the key feature of inheritance: share characteristics among a descendants in order to create a cohesive domain.

Thread Thread
 
danieldubovski profile image
Daniel Dubovski

I think the problem here is the terms we use.

I would love to see a reference to back you up. programming is prone to opinionated discussion, so some background to the opinion you hold might be helpful.

If by characteristics you mean properties, then I disagree, as a characteristic can also be a function (or a capability).

Anyway, I might be wrong, but check these out:

www2.latech.edu/~box/ase/tp/Per%20...

en.wikipedia.org/wiki/Object-orien...

esug.org/data/Old/ibm/tutorial/CHA...