This article has multiple issues. Please help improve it or discuss these issues on the talk page. (Learn how and when to remove these template messages)
This article may be in need of reorganization to comply with Wikipedia's layout guidelines. Please help by editing the article to make improvements to the overall structure.(October 2011) (Learn how and when to remove this template message)
This article needs additional citations for verification. Please help improve this article by adding citations to reliable sources. Unsourced material may be challenged and removed. Find sources: "Function overloading" – news · newspapers · books · scholar · JSTOR(October 2011) (Learn how and when to remove this template message)
(Learn how and when to remove this template message)
Not to be confused with Instruction overlapping or Overlay (programming).
Polymorphism
Ad hoc polymorphism
Function overloading
Operator overloading
Parametric polymorphism
Generic function
Generic programming
Subtyping
Virtual function
Single and dynamic dispatch
Double dispatch
Multiple dispatch
Predicate dispatch
v
t
e
In some programming languages, function overloading or method overloading is the ability to create multiple functions of the same name with different implementations. Calls to an overloaded function will run a specific implementation of that function appropriate to the context of the call, allowing one function call to perform different tasks depending on context.
For example, doTask() and doTask(object o) are overloaded functions. To call the latter, an object must be passed as a parameter, whereas the former does not require a parameter, and is called with an empty parameter field. A common error would be to assign a default value to the object in the second function, which would result in an ambiguous call error, as the compiler wouldn't know which of the two methods to use.
Another example is a Print(object o) function that executes different actions based on whether it's printing text or photos. The two different functions may be overloaded as Print(text_object T); Print(image_object P). If we write the overloaded print functions for all objects our program will "print", we never have to worry about the type of the object, and the correct function call again, the call is always: Print(something).
and 23 Related for: Function overloading information
In some programming languages, functionoverloading or method overloading is the ability to create multiple functions of the same name with different implementations...
object-oriented or procedural concepts, it is also known as functionoverloading or operator overloading. The term ad hoc in this context is not intended to be...
their arguments. Operator overloading is generally defined by a programming language, a programmer, or both. Operator overloading is syntactic sugar, and...
or function to use. Examples are templates in C++, and generic programming in Fortran and other languages, in conjunction with functionoverloading (including...
Look up overloading in Wiktionary, the free dictionary. The term overloading may refer to: Functionoverloading, a software engineering process whereby...
uses these types to instantiate suitable versions, resolving any functionoverloading appropriately. In some systems for object-oriented programming such...
respect to animalToFood. The above example can be realized using functionoverloading, for instance by implementing two methods animalToFood(animal: Chicken):...
same method name and parameters. Overloading is also referred to as function matching, and overriding as dynamic function mapping. For example, a base class...
function defined in <math.h> and <complex.h>. This adds a limited support for functionoverloading of the mathematical functions: the same function name...
interfaces, which are essentially templates made from function signatures. C++ uses functionoverloading with various signatures. The practice of multiple...
Electrical overloadFunctionoverloading, the ability to create multiple functions of the same name with different implementations Mechanical overload (engineering)...
robust functionoverloading but do not offer dynamic multiple dispatch (C++ only permits dynamic single dispatch through use of virtual functions). When...
namespace directive) or have different type signatures (such as in functionoverloading). It is required in these uses because each signature might require...
separately for each parameter. Usually this will rely on functionoverloading, or — if the function can simply pick one argument at a time — using a dumb...
as needed.: 340 Parametrically polymorphic functions and data types are sometimes called generic functions and generic datatypes, respectively, and they...
greatly simplified (a.k.a. Dynamic Visitor) by allowing use of simple functionoverloading to cover all the cases being visited. A dynamic visitor, provided...
substitutability, meaning that program elements (typically subroutines or functions), written to operate on elements of the supertype, can also operate on...
supports functionoverloading (for both built-in functions and operators, and user-defined functions), so there might be multiple function definitions...
supports features such as call by name, multiple dispatch, functionoverloading, operator overloading, exception handling and arbitrary-precision arithmetic...
Foo(Fruit* bar); void Foo(const Fruit& bar); Example showing the functionoverloading capabilities of the C++ language void Foo(int bar); void Foo(int...
declarations. This is because the definition of functionoverloading only accounts for the function name, parameter type list and the enclosing namespace...