So I just created a struct that makes a rectangle. the struct itself look likes this
struct _rect
{
//bottom left vertex
int x = 0;
int y = 0;
// width and height
int width = 0;
int height = 0;
//top right vertex
int y2 = y + height;
int x2 = x + width;
};
//init rect
_rect rect01;
rect01.x = rect01.y = 50;
rect01.width = rect01.height = 200;
in the main cpp when I want to create an instance of it I just want to enter bottom left x and y, plus width and height and I want it to calculate top right vertex by itself, is there a way to assign x2 and y2 their values without manuly doing so ?