"Overloading" a function means that you have multiple functions with the same name, but different signatures. The signature of a function is its return type and number/types of parameters.
For example:
void foo(int a, char b)
can be distinguished from
void foo()
which can be distinguished from
void foo(double a)
which can be distinguished from
void foo(int a)
The program will call the correct function based off of the number and types of parameters it is given. So:
foo(1) will call the 4th example
foo(1.0) will call the 3rd example
foor() will call the 2nd example
and foo(1, 't') will call the 1st example
Note that MOST programming languages do not allow you to distinguish between function signatures by return type, thus:
void foo()
and
int foo()
is not allowed.
Function overloading should not be confused with function overriding. Overriding involves inheritance and is related to polymorphism.
Copyright © 2026 eLLeNow.com All Rights Reserved.