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 3 - slide 9 : 27
Program 2

/* Matches using promotions. */

#include <iostream>
#include <string>

using namespace std;

void f(long int i){                 // Match: promotion
  cout << "f(long int)" << endl;
}

void f(short int i){                // Match: promotion
  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)

}