More definitions
Parametric Polymorphism:
- A polymorphic function has an implicit or explicit type parameter that determines the type of the argument for each application of that function
- Ex: A list of ints is not a list of strings, but they are both lists
Inclusion Polymorphism:
- An object can be viewed as belonging to many different classes that need not be disjoint; that is, there may be inclusion of classes
- Ex: a ColorRectangle is also a Rectangle