As we know, there are 3 basic parts to a function header: the type, name, and parameter list.
type name(<parameter list>)
- When distinguishing between overloaded functions, only the name and parameter list are used; call this the function's signature
- The type is NOT used to resolve the function call
- The name and parameters together must be unique
int myFunc(int a); // ok
int myFunc(long a); // ok
float myFunc(float a); // ok
double myFunc(double a); // ok
float myFunc(int a); // error, not unique
double myFunc(float a); // error, not unique
double myFuncA(float a); // ok, different name
int myFunc (int a, double b); // ok
int myFunc (double a, int b); // ok
double myFunc (double x, int y); // error, not unique
For two functions to be considered identical:
- They must both have the same name
- The parameter lists must match; both functions must have the same number and type of parameters and the parameters must be in the same order