Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- class horse {
- int speed, age;
- public:
- horse() {
- speed = age = 0;
- }
- horse(int _speed, int _age) {
- speed = _speed;
- age = _age;
- }
- ~horse() {
- speed = age = 0;
- }
- int horse_age() {
- return age++;
- }
- int run() {
- return speed++;
- }
- void horse_print() {
- cout << speed << " " << age << endl;
- }
- };
- class bird {
- int height_fly, eggs;
- public:
- bird(){
- height_fly = eggs = 0;
- }
- bird(int _height_fly, int _eggs) {
- height_fly = _height_fly;
- eggs = _eggs;
- }
- ~bird() {
- height_fly = eggs = 0;
- }
- int up() {
- return height_fly++;
- }
- int lay_eggs() {
- return eggs++;
- }
- void bird_print() {
- cout << height_fly << " " << eggs << endl;
- }
- };
- class pegas : public horse, public bird {
- int s;
- public:
- pegas() { s = 0; }
- pegas(int _speed, int _age, int _height_fly, int _eggs, int _s) :horse(_speed, _age), bird(_height_fly, _eggs) {
- s = _s;
- }
- void pegas_print() {
- horse_print();
- bird_print();
- }
- };
- int main() {
- horse H;
- bird B;
- pegas P;
- H.horse_age();
- H.horse_age();
- H.horse_age();
- H.horse_age();
- H.run();
- B.up();
- B.up();
- B.lay_eggs();
- B.lay_eggs();
- B.lay_eggs();
- P.pegas_print();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement