The function was like Code: class calc { float area(float a) { return a*a; } int area(int a) { return a*a; } }; main() { calc ob1; ob1.area(10); ob1.area(10.5); getch(); }
Because Code: int foo(int bar) { ... } int quux() { foo(10.5); } is legal, so the compiler doesn't know if the second call to area() is to area(int(10.5)) or area(float). The cast removes the ambiguity.