constructors/point.h - Class Point with a variety of constructors. | Lecture 4 - slide 8 : 40 Program 1 |
// Class Point with funny constructors. class Point { private: double x, y; public: Point(); // default constructor: (0,7) Point(double x); // (x, 20) Point(double x, double y); // (x, y) Point(const Point& p); // copy constructor: (p.x+1, p.y+2) double getx () const; double gety () const; }; std::ostream& operator<<(std::ostream&, const Point&);