Back to slide -- Keyboard shortcut: 'u'  previous -- Keyboard shortcut: 'p'                friends/point-with-friends-conversion/prog.cc - The program that use the operator.Lecture 4 - slide 37 : 40
Program 3

// Illustrates implicit type conversion on the targets of move and Move.

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

using namespace std;

// Friend of Point. Returns moved copy of p.
Point Move(const Point &p, double dx, double dy){
  return Point(p.x + dx, p.y + dy);
}

int main(){

  Point p(1,2), q(3,4), r;

  Point(3).move(1,2);        // Moving temporary Point - not useful.
//3.move(1,2);               // Point(3).move(1.2) is not attempted.  
                             // No implicit conversion on the value to the left of the dot operator.
  r = Move(3,  1,2);         // Implicit conversion of 3.0 to Point(3.0).
                             // Moving this point to (4,5).

  cout << "Point p: " << p << endl;   // (1,2)
  cout << "Point q: " << q << endl;   // (3,4)
  cout << "Point r: " << r << endl;   // (4,5)
}