Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct SRect
- {
- int x;
- int y;
- int width;
- int height;
- };
- class Rect
- {
- private: // # Though its already private but what the heck
- int x;
- int y;
- int width;
- int height;
- public: // # Public functions
- Rect() // # No Args
- {
- x = 0;
- y = 0;
- width = 0;
- height = 0;
- }
- // # With Parameters
- Rect( int sx, int sy, int swidth, int sheight )
- {
- x = sx;
- y = sy;
- width = swidth;
- height = sheight;
- }
- // Getters
- int getX() { return x; }
- int getY() { return y; }
- int getWidth() { return width; }
- int getHeight() { return height; }
- // Setter
- void set( int nx, int ny, int nwidth, int nheight )
- {
- x = nx ;
- y = ny ;
- width = nwidth ;
- height = nheight ;
- }
- void setX(int nx) { x = nx; }
- void setY(int ny) { y = ny; }
- void setWidth(int nwidth) { if (nwidth > 0 ) { width = nwidth; } }
- void setHeight(int nheight) { if (nheight > 0 ) { height = nheight; } }
- };
Advertisement
Add Comment
Please, Sign In to add comment