4 ms·
>In this issue, proper understanding is muddled by "OOP" languages that have a static type system which uses inheritance as a gatekeeper to polymorphism. I am
by alasdair_ 8y ago
>In this issue, proper understanding is muddled by "OOP" languages that have a static type system which uses inheritance as a gatekeeper to polymorphism.
I am trying to think of a commonly used language that exclusively uses inheritance to implement polymorphism. (Unless you consider Java’s interfaces to be inheritance when they are the language’s alternative to using inheritance.)
- TeMPOraL 8y ago> (Unless you consider Java’s interfaces to be inheritance when they are the language’s alternative to using inheritance.) Having come to Java from C++, I always considered Java's interfaces to be a syntactic sugar on top of inheritance. In C++, there is (or was, back then) no meaningful difference between "interface" inheritance and "class inheritance" - and why would there be, if it boils down to stringing up vtables together?
- kazinator 8y agoJava's interfaces are clearly inheritance, by the principle that a dog's rearmost appendage is a tail, even if we call it a leg.