We are used to regular functions, or class methods, being overloaded—multiple functions with the same name have different parameter types. Each call invokes the function with the best match of the parameter types to the call arguments, as show in the following example:
void whatami(int x) { std::cout << x << " is int" << std::endl; }void whatami(long x) { std::cout << x << " is long" << std::endl; }whatami(5); // 5 is intwhatami(5.0); // Compilation error
If the arguments are a perfect match for one of the overloaded functions with the given name, that function is called. Otherwise, the compiler considers conversions to the parameter types of the available functions. If one of the functions offers better conversions, ...