3 ms·
I doubt there's any programme you've ever written that makes no use of polymorphism (the contextual resolution between multiple semantics to a term). Even 1 +
by mjburgess 7y ago
I doubt there's any programme you've ever written that makes no use of polymorphism (the contextual resolution between multiple semantics to a term).
Even 1 + 1 is polymorphic, ie., "1" + "1" selects for a different behaviour.
Method overriding may rely on inheritance, and the problem is usually the inheritance not the polymorphism.
- nightski 7y agoThey did not specifically state it but I believe he/she was referring to subtype polymorphism. Parametric polymorphism as you describe is far more useful imho.
- mjburgess 7y agoThere are many types -- it is phrased generally and may lead readers to believe that there is some issue with polymorphism. I still object on the subtype grounds though -- because the issue is not the polymorphism (that is useful and usually a good idea). It's the inheritance relation, which is not the subtype relation -- eg., you can do subtype polymorphism with just implementing interfaces and there shouldn't be any problems. This comment is actually expressing issues which have arisen because of inheritance and confusing it with polymorphism.