Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Rectangle
- {
- public:
- Rectangle(int h_ = 0, int w_ = 0): height(h_), width(w_)
- {
- }
- void set_size(int h, int w)
- {
- do_set_size(h, w);
- }
- protected:
- void do_set_size(int h, int w)
- {
- height = h;
- width = w;
- }
- private:
- int height, width;
- };
- class Square: protected Rectangle
- {
- public:
- Square(int h_): Rectangle(h_, h_)
- {
- }
- void set_size(int h)
- {
- do_set_size(h, h);
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement