Means many forms
Variables have a static type that we know at compile time but also have a dynamic type which is the object a variable refers to at a point in execution.
If a variable has multiple of those dynamic types it is polymorphic.
Definition
A polymorphic call target is the method at runtime that actually determines the type of an object (instead of the declared type of the variable which can be somehting else due to inheritence)
There are different types of Polymorphism:
- Subtype: A subtype object can be used in place of the supertype object. This is what we see when we extend
Expr - Parametric: Lets a function be written generically (
<T>or generics in Typescript) so that you don’t need to know a specific type at compile time - Ad-hoc: This is where functions have different implementations for different data types. Think function overloading.