| Simple examle of an ambiguity. | Lecture 2 - slide 27 : 42 Program 2 |
#include <iostream>
#include <string>
using namespace std;
void f(long int i){
cout << "f(long int)" << endl;
}
void f(short int i){
cout << "f(short int)" << endl;
}
int main(){
int c = 5;
f(c); // error: call of overloaded f(int&) is ambiguous
// note: candidates are: void f(long int)
// note: void f(short int)
}