Utilizor
Contact Us

C++ Function Overloading

Multiple functions with the same name.

C++ Function Overloading

With function overloading, multiple functions can have the same name with different parameters:

int myFunction(int x)
float myFunction(float x)
double myFunction(double x, double y)

Instead of defining two functions that should do the same thing, it is better to overload one.

In the example below, we overload the plusFunc function to work for both int and double: