Trivial Conversions

Functions cannot be distinguished if they have the same name and have arguments that differ only in that one is declared as a reference to a type and the other is that type. You cannot have two functions with the same name and with arguments differing only in this respect. Because the following two declarations cannot be distinguished, the second one causes an error:

double f(double i);  // declaration

double f(double &i); // error

However, functions with the same name having arguments that differ only in that one is a pointer or reference and the other is a pointer to const or const reference can be distinguished. Functions with the same name having arguments that differ only in that one is a pointer or reference and the other is a pointer to volatile or volatile reference can also be distinguished. For the purpose of finding a best match of arguments, functions that have a volatile or const match (not requiring a trivial conversion) are better than those that have a volatile or const mismatch.



Argument Matching in Overloaded Functions
Sequence of Argument Conversions


Pointer
Reference
User-Defined Conversions
Overloading Functions
Overloading Operators