Next - Previous     
    Overview        Class Hierarchy        Types of Polymorphism          Resources

Ad-hoc polymorphism:

It usually refers to simple overloading.

Overloading:

Overloading allows multiple functions taking different types to be defined with the same name;
the compiler automatically calls the right one. This way, functions appending lists of integers, list of string,
list of real numbers, and so on could be written, and all be called append - and the right append function
would be called based on the type of lists being appended. This differs from parametric polymorphism,
in which the function would need to be written generically, to work with any kind of list. Using overloading,
it is possible to have a function perform two completely different things based on the type or number of
parameters it takes; this is not possible with parametric polymorphism.

This type of polymorphism is common in object-oriented programming language, many of which allow
operators to be overloaded in a manner similar to functions.