Polymorphism means "many forms" and is the opposite of uniform.
In Object-Oriented programming languages there are three types of polymorphism: subtype polymorphism, parametric polymorphism, and ad-hoc polymorphism.
Ad-hoc polymorphism is a fancy word for overloading or name sharing. For example, several methods in a class can have the same name provided their parameter lists are different:
class Initializer {
static void init(Printer x) { ... }
static void init(Monitor x) { ... }
static void init(Keyboard x) { ... }
// etc.
}
In this example there are three functions named init or three variants of the name init.
When the compiler sees a call to init:
Initializer.init(someDevice);
it uses an algorithm called variant selection to determine which function should be called. In this case it would match the declared type of the variable someDevice to the declared parameter types of the variants of init.
The matching algorithm can be very clever. For example, the declared type of someDevice might be HPPrinter, a subtype of Printer and therefore the Printer variant of init will be called. In some cases the algorithm can be too clever and unintended matches can be found when a type error should be given instead.
Subtype polymorphism refers to the subsumption rule. We can interpret it to say that a value can have many types, namely the actual type of the value, as well as all super types of this type.
In parametric polymorphism a value can have a parameterized type. Such values are called generics.
A generic algorithm (function or procedure) doesn't care about the type of data it manipulates. For example, a generic sorting algorithm doesn't care what type of data it sorts as long as instances of the type can be compared. This saves us the headache of declaring fifty nearly identical sorting functions: one for numbers, one for lists, one for dates, etc.
A generic type doesn't care about the types of its components. For example, a generic stack can be used to stack numbers, strings, or dates. This saves us the headache of declaring fifty nearly identical types.