function-overloading/overloading-9.cc - A trivial example with overloading of a function of two parameters. | Lecture 2 - slide 31 : 46 Program 10 |
#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 }