| function-overloading/overloading-9.cc - A trivial example with overloading of a function of two parameters. | Lecture 3 - slide 9 : 27 Program 10 |
/* Matching that involves two parameters. */
#include <iostream>
#include <string>
using namespace std;
void f(int i, double d){
cout << "f(int, double)" << endl;
}
void f(double d, int i){
cout << "f(double, int)" << endl;
}
int main(){
f(5, 5.5); // f(int, double)
f(5.5, 5); // f(double, int)
f(5, 6); // Ambiguous
f(5.6, 6.5); // Ambiguous
}