Back to slide -- Keyboard shortcut: 'u'  previous -- Keyboard shortcut: 'p'  next -- Keyboard shortcut: 'n'          function-overloading/overloading-6.cc - 'double to char' instead of 'double to Point'.Lecture 3 - slide 9 : 27
Program 7

/* One best match using a standard conversions. One match at lower level */
/* (user defined conversion). One not matching 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;
}

void f(char c){                        // Match - standard conversion
  cout << "f(char)" << endl;
}





int main(){
  double c = 5.5;        
  f(c);                   // A single best match:  f(char)
                          // The conversion double -> char is in a higher category than
                          // the user-defined double -> Point
} 

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