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

// Point and LineSegments with default copy constructors - memberwise copying.

#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;                               // A dynamically allocated array of points
  size_t number_of_points;
public:
  LineSegment(size_t s = 10);                  // Serves the role as default constructor.
  LineSegment(const LineSegment&) = default;   // LineSegment has a default copy constructor
  ~LineSegment();
  // ...
};

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