kokokozhina

Untitled

Dec 10th, 2015
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.96 KB | None | 0 0
  1. #include <iostream>
  2. //lol
  3. using namespace std;
  4.  
  5. class Cobaka {
  6.     public:
  7.         Cobaka() { cout << "Konstr" << endl; }
  8.         ~Cobaka() { cout<<"Destr"<<endl; }
  9.  
  10.         void setCobaka(int ves,int vozrast) {
  11.             itsves = ves;
  12.             itsvozrast = vozrast;
  13.         }
  14.        
  15.         void getCobaka() {
  16.             cout << "Ves= " <<itsves << endl;
  17.             cout << "Vozrast= " << itsvozrast << endl;
  18.         }
  19.        
  20.         void lai() { cout<< "Gav!"<< endl; }
  21.  
  22.     protected:
  23.         int itsves;
  24.         int itsvozrast;
  25. };
  26.  
  27.  
  28. class Dog: public Cobaka {
  29.     public:
  30.         Dog() { cout<<"Konstr" <<endl; }
  31.         ~Dog() { cout<<"Destr"<< endl; }
  32.  
  33.         void setDog(bool cvet) { itscvet = cvet; }
  34.         void getDog() { cout <<"Cvet = "<<endl; }
  35.         void lai() { cout <<"Gav!Gav!"<< endl; }
  36.  
  37.     protected:
  38.         bool itscvet;
  39. };
  40.  
  41. int main() {
  42.     {
  43.       Cobaka Poli;
  44.  
  45.     Poli.setCobaka(5,4);
  46.       Poli.getCobaka();
  47.       Poli.lai();
  48.  
  49.       Dog Gera;
  50.       Gera.setCobaka(6,5);
  51.       Gera.getCobaka();
  52.       Gera.lai();
  53.       Gera.lai();
  54.     }
  55.  
  56.     cin.get();
  57.     return 0;
  58. }
Advertisement
Add Comment
Please, Sign In to add comment