Back to notes -- Keyboard shortcut: 'u'  previous -- Keyboard shortcut: 'p'  next -- Keyboard shortcut: 'n'  Slide program -- Keyboard shortcut: 't'    'Float to double' conversion prefered over 'float to int' and 'float to long int'.Lecture 2 - slide 27 : 42
Program 4
#include <iostream>
#include <string>

using namespace std;

void f(int i){
  cout << "f(int)" << endl;
}

void f(long int i){
  cout << "f(long int)" << endl;
}

void f(double d){
  cout << "f(double)" << endl;
}

int main(){
  float c = 5.5;
  f(c);             // A single best match:  f(double)  
                    // The float to double promotion is in another category than
                    // float -> int  and  float -> long int.
}