Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- //lol
- using namespace std;
- class Cobaka {
- public:
- Cobaka() { cout << "Konstr" << endl; }
- ~Cobaka() { cout<<"Destr"<<endl; }
- void setCobaka(int ves,int vozrast) {
- itsves = ves;
- itsvozrast = vozrast;
- }
- void getCobaka() {
- cout << "Ves= " <<itsves << endl;
- cout << "Vozrast= " << itsvozrast << endl;
- }
- void lai() { cout<< "Gav!"<< endl; }
- protected:
- int itsves;
- int itsvozrast;
- };
- class Dog: public Cobaka {
- public:
- Dog() { cout<<"Konstr" <<endl; }
- ~Dog() { cout<<"Destr"<< endl; }
- void setDog(bool cvet) { itscvet = cvet; }
- void getDog() { cout <<"Cvet = "<<endl; }
- void lai() { cout <<"Gav!Gav!"<< endl; }
- protected:
- bool itscvet;
- };
- int main() {
- {
- Cobaka Poli;
- Poli.setCobaka(5,4);
- Poli.getCobaka();
- Poli.lai();
- Dog Gera;
- Gera.setCobaka(6,5);
- Gera.getCobaka();
- Gera.lai();
- Gera.lai();
- }
- cin.get();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment