Advertisement
Guest User

Untitled

a guest
Feb 8th, 2016
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class People
  2. {
  3. private:
  4.     int health;
  5.     int age;
  6. public:
  7.     People()
  8.     {
  9.         health = 1;
  10.         age = 1;
  11.     }
  12.     People(int h,int a)
  13.     {
  14.         health = h;
  15.         age = a;
  16.     }
  17.  
  18.     void GetHealth()
  19.     {
  20.         qDebug() <<health;
  21.  
  22.     }
  23.     void GetAge()
  24.     {
  25.         qDebug() <<age;
  26.  
  27.     }
  28.  
  29.     void SetHAA(int h,int a)
  30.     {
  31.         health = h;
  32.         age = a;
  33.     }
  34.  
  35.  
  36.     virtual void information()
  37.     {
  38.         qDebug()<<"I usually people. i have health ="<< health <<"and my age = "<< age ;
  39.     }
  40.  
  41. };
  42.  
  43. class Mage : public People
  44. {
  45. private:
  46.     int mana;
  47. public:
  48.     Mage(int h,int a,int m)
  49.     {
  50.         SetHAA(h,a);
  51.         mana = m;
  52.     }
  53.  
  54.     void information()
  55.     {
  56.         qDebug()<<"Im super mage i have health =";
  57.         GetHealth();
  58.         qDebug()<<"and my age = ";
  59.         GetAge() ;
  60.     }
  61.  
  62.     void spell();
  63. };
  64.  
  65. class Tank: public People
  66. {
  67. private:
  68.     int armor;
  69. public:
  70.     void information()
  71.     {
  72.         qDebug()<<"I powerfull tank i have health =";
  73.                   GetHealth();
  74.                   qDebug()<<"and my age = ";
  75.                   GetAge() ;
  76.     }
  77.     void shield();
  78. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement