| static-members/prog.cc - A client of class Point. | Lecture 4 - slide 25 : 40 Program 3 |
#include <iostream>
#include "point.h"
using namespace std;
int main(){
Point p, // Default constructor use defaultPoint: (5,7)
q(3,4), // (3,4)
r = Point::origo(), // origo can be accessed via the class: Point::origo().
s = p.origo(); // ... and via an instances: p.origo(). Both are (0,0).
cout << "p: " << p << endl; // (5,7)
cout << "q: " << q << endl; // (3,4)
cout << "r: " << r << endl; // (0,0)
cout << "s: " << s << endl; // (0,0)
Point::setDefaultPoint(q);
Point t; // The default constructor uses
// the new defaultPoint.
cout << "t: " << t << endl; // (3,4)
}