| The C++ client program with Point value semantics. | Lecture 2 - slide 42 : 42 Program 9 |
#include <iostream>
#include "point.h"
using namespace std;
Point pointmover(Point pa, Point pb){
pa.move(5,6);
pb.move(-5,-6);
return pb;
}
void go(){
Point p1(1, 2),
p2(3, 4),
p3 = p1,
p4 = p2;
Point p5 = pointmover(p1, p2);
cout << p1 << endl << // (1,2)
p2 << endl << // (3,4)
p3 << endl << // (1,2)
p4 << endl << // (3,4)
p5 << endl; // (-2,-2)
}
int main(){
go();
}