ST
* Polymorphism
Ability of a function to handle values of different types.
Polymorphism is a fundamental property of a type system.
Polymorphism
|
_____________ /|\________________
| | |
Parametric Ad hoc Subtyping/Inclusion
*** Parametric
- execution of the same code for all legal types.
In the object-oriented programming community, this is often known as
generics or generic programming.
In the functional programming community, this is often shortened to
polymorphism.
*** Ad hoc
- execution of different code for every type.
Function overloading allows to implement ad hoc polymorphism.
*** Subtyping/Inclusion
- a function, written to operate on elements of the supertype can also
operate on elements of the subtype.
In the object-oriented programming community, this is often shortened to
polymorphism.
* Source
1. Hexlet - Полиморфизм: параметрический и ad hoc
2. Полиморфизм_(информатика)
3. Ad_hoc_polymorphism
4. Polymorphism_(computer_science)

