#include <iostream>
class Rect
{
public:
//parameterized constructor
Rect(int px, int py, unsigned int pwidth, unsigned int pheight): x(px), y(py), width(pwidth), height(pheight)
{
x2 = x + width;
y2 = y + height;
};
//getter so that we can get the value of x2
int getX2()
{
return x2;
}
//getter so that we can get the value of y2
int getY2()
{
return y2;
}
private:
int x = 0;
int y = 0;
unsigned int width = 0;
unsigned int height = 0;
int x2 = 0, y2 = 0;
};
int main()
{
//create Rect instance
Rect r(50, 50, 200, 200);
//lets check if x2 and y2 were calculate correctly
std::cout<<"x2 is: "<< r.getX2()<<std::endl;
std::cout<<"y2 is: "<< r.getY2()<<std::endl;
}