#ifndef __SEGMENT_H__ #define __SEGMENT_H__ #include #include "Point.h" using namespace std; class Segment { public: Segment(); // can you add a constructor that allows you to declare 'Segment s(x1,y1,x2,y2);' in TestSegment.cpp ? // and then a constructor for the kind of 'Segment s(p1, p2);' virtual ~Segment(); void print(); private: Point *m_p0, *m_p1; }; Segment::Segment() { m_p0 = new Point(); m_p1 = new Point(); m_p0->x = 0; m_p0->y = 0; m_p1->x = 1; m_p1->y = 1; } void Segment::print() { cout << "(" << m_p0->x << " " << m_p0->y << ") - (" << m_p1->x << " " << m_p1->y << ")"; } Segment::~Segment() { cerr << "segment deleted"; } #endif