Answer to Question #209014 in C++ for Shema

Question #209014

Use the aggregation (composition)

concept to define and implement the

class line(pl.x, pl.y, p2.x, p2.y) by using

two points variables P 1, and P2 of type

point2D class defined in QI. Beside the

two points Pl and P2, the line class has

the following functions: print(),

MoveRel(Dx,Dy) (use the point2D's

MoveRel(Dx,Dy) function of the two

points to achieve that), line(),


1
Expert's answer
2021-06-20T18:13:57-0400
class line{
    private: 
        point2D p1;
        point2D p2;
        
    public:  
        void print(){
            cout<<"P1= "<<p1;
            cout<<"P2= "<<p2;
        }
        void MoveRel(point2D Dx, point2D Dy){
            p1=Dx;
            p2=Dy;
        }
        line(){
            
        }
};

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS