Back to slide -- Keyboard shortcut: 'u'  previous -- Keyboard shortcut: 'p'  next -- Keyboard shortcut: 'n'          function-overloading/overloading-5.cc - double to Point via Point(double) constructor.Lecture 3 - slide 9 : 27
Program 6

/* One best match using user-defined conversion. One candidate function does not match at all.  */


#include <iostream>
#include <string>
#include "point.h"

using namespace std;

void f(Point p){                  // Match: user-defined conversion
  cout << "f(Point)" << endl;
}

void f(char *c){                  // No match
  cout << "f(char *)" << endl;
}









int main(){
  double c = 5.5;        
  f(c);                // A single best match: f(Point)
                       // f(char *) does not match at all.
}

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