![]() ![]() ![]() ![]() | A simple client program of Point. | Lecture 3 - slide 23 : 36 Program 3 |
#include <iostream> #include "point.h" using namespace std; int main(){ Point p(1,1); double pa = p.geta(), // Activates the caching. pr = p.getr(); cout << "Point p rectangular: " << p.getx() << ", " << p.gety() << endl; cout << "Point p polar: " << p.getr() << ", " << p.geta() << endl; p.move(2,2); // Invalidates the cache cout << "p moved relatively by (2,2)" << endl; cout << "Point p rectangular: " << p.getx() << ", " << p.gety() << endl; cout << "Point p polar: " << p.getr() << ", " << p.geta() << endl; // Activates the caching. }