Number 1, 2, 3. Number 4, updated number 1.
You see, higher qualifier-constructors do not affect the declaration of a function. They change the way you use them in a function definition, but it's still the same function
void f(int); void f(const int);
This, on the other hand, is wonderful.
void f(const int); void f(int x)
Note that top-level constants do not participate in overload resolution. For instance.
void f(int & x) void f(const int & x)
And finally, you ask
Only overload functions are executed only when the number or type of arguments is different?
Yes, thatβs correct, but int , int* and int& are different types. Of course, in case 1 or 3, in most cases these will be ambiguous calls, but in some cases the compiler can determine what you mean. for instance
void f(int); void f(int&); f(3)
source share