self-reference/prog.cc - A sample use of points, with emphasis on moving. | Lecture 4 - slide 28 : 40 Program 3 |
#include <iostream> #include <string> #include "point.h" int main(){ using namespace std; Point p1(1,2), *p2 = new Point(1,2); p1.move(1,1)->move(2,2); p2->move(1,1)->move(2,2); cout << p1 << endl; // (4,5) cout << *p2 << endl; // (4,5) }