void f(int i)
{
}
void f(int &i)
{
}
The function f() is overl;oaded to accept an int value and an int reference . but if we call f() as shown
int i = 9;
f(i);
the compiler cannot figure out whether to call the version of f() that accepts a value or the one that accepts a reference. since the syntex of calling both is same, it result in an ambiguity;

0 comments:
Post a Comment