Back to slide -- Keyboard shortcut: 'u'  previous -- Keyboard shortcut: 'p'  next -- Keyboard shortcut: 'n'          function-overloading/overloading-2.cc - Simple examle of an ambiguity.Lecture 2 - slide 31 : 46
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)

}