Explore BrainMass

Visual C++

The following class uses composition to define a line object in terms of two point objects.

class line
Point startingpoint();
point endingpoint();
float length();
line (int startX, int startY, int endX, int endY);

point startPoint;
point endPoint:


1) write a fucntin defintion for the Line class constructor
2) for the line class implement the StartingPoint() and EndingPoint() member functions
3) for the line class implement the lenght() member function. the distance between two points (x1,y1) and (x2,y2) is sqrt ((x1,x2)2 + (x2,y2)2)