#ifndef _LINESEGMENT_H #define _LINESEGMENT_H #include "Point.h" class LineSegment { private: // fields Point* p1; Point* p2; // private initialization method (called by constructors and =) void init(int x1, int y1, int x2, int y2); public: // constructors/destructors LineSegment(int x1, int y1, int x2, int y2); LineSegment(const LineSegment& line); // copy constructor ~LineSegment(); // destructor // methods int getX1() const; int getY1() const; int getX2() const; int getY2() const; double length() const; double slope() const; void translate(int dx, int dy); // overloaded assignment = operator (to avoid memory leaks) const LineSegment& operator=(const LineSegment& rhs); }; #endif