The following class uses composition to define a line


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

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

private:
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)

Solution Preview :

Prepared by a verified Expert
C/C++ Programming: The following class uses composition to define a line
Reference No:- TGS01247131

Now Priced at $20 (50% Discount)

Recommended (99%)

Rated (4.3/5)