How to resolve an ambiguous call between the two in C ++?
Color(int, int, int)
Color(float, float, float)
This is ambiguous when the values are hardcoded, i.e. Color(1, 2, 3)and when they are variables Color(r, g, b). Why did the compiler not allow according to the data type? In variable form?
EDIT: Sorry, too much C ++ makes me forget about other languages. And there is not much "full code."
float x, y, z;
int r, g, b;
Color(1, 2, 3);
Color(1.0, 2.0, 3.0);
Color(r, g, b);
Color((int)r, (int)g, (int)b);
Color(x, y, z);
Color(1u, 2u, 3u);
Color(1.0f, 2.0f, 3.0f);
source
share