I have this assignment to do:: can u help??
Tutorial Exercise
Set up a class called Point which contains two Members x and y which represent a point on the Screen. Write functions to return the values associated with x and y.
Now write a class called Rectangle which contains two Points. The Points represent the top left screen position and the bottom Right screen position for the rectangle.
Write functions to return the values associated with the points In the rectangle. You will obviously need to provide suitable Constructors. Experiment with the pointer and non pointer members solutions
Here is the code for the Rectangle class
Code:Class Rectangle { Point* p1; Point* p2; public: Rectangle(int x, int y, int p, int q); Point* getp1(); Point* getp2(); }
any help would be appreciated
thanx
Jason
![]()
![]()
![]()




Reply With Quote