Good day, community!
Just started learning with ++, so don't be hard on you.
I read the book "Programming in C ++. Dirk Henkemans, Mark Lee." It gives the following example of function overloading:
int add (int a, int b) { return a + b; } float add (float a, float b) { return a + b; } int main(void) { cout << add(5,3); cout << add(5.5, 4.7); return }
However, my code does not compile. The compiler does not understand this construction, and swears: call of overloaded `add (double, double) 'is ambiguous . How is it going?
In some forums, they write that the c ++ compiler cannot determine whether an integer is related to an int or float.