Back to slide -- Keyboard shortcut: 'u'  previous -- Keyboard shortcut: 'p'  next -- Keyboard shortcut: 'n'          function-overloading/overloading-4.cc - An ambiguity between 'float to int' and 'float to long int'.Lecture 2 - slide 31 : 46
Program 3

#include <iostream>
#include <string>

using namespace std;

void f(int i){
  cout << "f(int)" << endl;
}

void f(long int i){
  cout << "f(long int)" << endl;
}





int main(){
  float c = 5.5;
  f(c);             // error: call of overloaded  f(float&)  is ambiguous
                    // note: candidates are: void f(int)
                    // note:                 void f(long int)

}

// This example is continued in the next program...