| Now in an ambiguity situation. | Lecture 2 - slide 27 : 42 Program 8 |
#include <iostream>
#include <string>
#include "point.h"
using namespace std;
void f(Point p){
cout << "f(Point)" << endl;
}
void f(char *c){
cout << "f(char *)" << endl;
}
void f(char c){
cout << "f(char)" << endl;
}
void f(float c){
cout << "f(float)" << endl;
}
int main(){
double c = 5.5;
f(c); // error: call of overloaded f(double&) is ambiguous
// note: candidates are: void f(Point)
// note: void f(char)
// note: void f(float)
}