Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class food{
- name;
- calories;
- weight;
- public eat(name);
- }
- class pizza inherits food{
- toppings;
- say_toppings();
- }
- bool lid_open = false;
- void open_water_bottle_by_twisting() { lid_open = true; }
- class Container
- {
- bool lid_open = false;
- protected:
- Container() {}
- void open_by_twisting()
- {
- lid_open = true;
- }
- public:
- virtual ~Container();
- };
- class WaterBottle : public Container
- {
- WaterBottle() : Container() {}
- public:
- ~WaterBottle();
- };
- class Container
- {
- bool lid_open;
- bool straw_open;
- protected:
- void TurnLid() { lid_open = true; }
- void BendStraw() { straw_open = true; }
- Container() : lid_open(false), straw_open(false){}
- public:
- virtual void open() = 0;
- virtual ~Container();
- };
- class WaterBottle : public Container
- {
- public:
- WaterBottle() : Container() {}
- void open()
- {
- TurnLid();
- }
- ~WaterBottle();
- };
- class ExerciseBottle : public Container
- {
- public:
- ExerciseBottle() : Container() {}
- void open()
- {
- BendStraw();
- }
- ~ExerciseBottle();
- };
Add Comment
Please, Sign In to add comment