For strong type languages, polymorphism usually means that type A derives from type B or C, In weakly typed languages types are implicitly polymorphic: duck typing allows polymorphism without inheritance.
There are some disputes whether overloading and overriding is a part of polymorphism.
- Wikipedia explains they are not the same. (Polymorphism is not the same as method overloading or method overriding.1 Polymorphism is only concerned with the application of specific implementations to an interface or a more generic base class.)
- Some of OOP books explain "method overloading" as an example of polymorphism.
- This paper explains overloading as a part of polymorphism
- This post explains that overriding is a part of polymorphism, whereas overloading is not.
Generic programming is also known as "parametric polymorphism".
No comments:
Post a Comment