3 ms·
> Inheritance forces you to define the world in terms of strict tree hierarchies, No, it doesn’t. Inheritance is the outcome of deciding to model some part of
by dragonwriter 3y ago
> Inheritance forces you to define the world in terms of strict tree hierarchies,
No, it doesn’t.
Inheritance is the outcome of deciding to model some part of the problem space with a tree hierarchy (that potentially intersects other such heirarchies). It doesn’t force you to do anything.
I suppose if there was a methodology which forced you, as the only modeling method, to exclusively use single inheritance, that would force you to do what you describe, but…that’s not inheritance, that’s a bunch of weird things layered on top of it.
- eddd-ddde 3y agoIt may not force you directly, but I think it's safe to say that when a language focuses on inheritance (e.g. c++) it does not offer good alternatives (e.g. rust traits). This means that if you want features such as runtime polymorphism, you are _kinda_ forced into inheritance.