![]() ![]() ![]() | Class LineSegment WITH a copy constructor and and WITH an assignment operator. | Lecture 3 - slide 16 : 36 Program 1 |
#include <iostream> class Point { private: double x, y; public: Point(double, double); Point(); double getx () const; double gety () const; void move(double, double); double distance_to(Point) const; }; class LineSegment { private: Point *points; size_t number_of_points; public: LineSegment(size_t = 10); // Default constructor LineSegment(const LineSegment&); // Copy constructor ~LineSegment(); // Destructor LineSegment& operator=(const LineSegment&); // Assignment operator // ... }; std::ostream& operator<<(std::ostream&, const Point&);