Back to slide -- Keyboard shortcut: 'u'        next -- Keyboard shortcut: 'n'          copying-objects/vers2/point-lineseg.h - Class LineSegment WITH a copy constructor and and WITH an assignment operator.Lecture 4 - slide 20 : 40
Program 1

#include <iostream>

class Point {
private: 
  double x, y;

public:
  Point(double, double);
  Point();
  Point(const Point&) = default;                // Point has a default copy constructor
  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 provided for LineSegment
  ~LineSegment();                               // Destructor

  LineSegment& operator=(const LineSegment&);   // Assignment operator provided for LineSegment
  // ...
};

std::ostream& operator<<(std::ostream&, const Point&);