By Stephen R. Davis

C++ allows the programmer to assign the same name to two or more functions if the functions can be distinguished by either the number or types of arguments they contain. This practice is called function overloading. Consider the following example functions:

void someFunction()
{
    // ...perform some function
}
void someFunction(int nValue)
{
    // ...perform some other function
}
void someFunction(char cValue)
{
    // ...perform a function on characters
}
int main(int nNumberofArgs, char* pszArgs[])
{
    someFunction();    // call the first function
    someFunction(10);  // call the second function
    someFunction('a'); // now the third function
    return 0;
}

Comparing each of the preceding calls with the declarations makes clear which function is meant by each call. C++ aficionados include the type of arguments with the name of the function in what is called the function’s extended name or signature. Thus, the extended names of the three functions are, in fact, different: someFunction(), someFunction(int), and someFunction(char).

Notice that the return type is not part of the extended name and cannot be used to differentiate functions.