title: Need help implementing Health in basic C++ attack game
body: <p>The main value of this extremely simple attack game (for me) is to familiarize myself with simple polymorphism, and to practice using pointers. With that said, I would love to add onto it. Looking at my program, I'm not sure If I should create a separate "Hero" class, and to just have that inherit from the "Character" class, or if I should just assume that the Hero IS the "Character" class, which the enemies inherit from. The only thing I want to do right now is to implement something where the Hero's health decreases after attack. Sorry if it's very rudimentary, I'm just trying to get the basics down.</p>
  
  <p>Thanks.</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include "Character.h"
  
  using namespace std;
  
  int main() {
  
      Ninja n;
      Dragon d;
  
      Character *enemy1 = &amp;n;
      Character *enemy2 = &amp;d;
  
      enemy1-&gt;setAttackPower(20);
      enemy2-&gt;setAttackPower(40);
  
      n.attack();
      d.attack();
  
      return 0;
  }
  
  
  //Character.h
  #include &lt;iostream&gt;
  
  using namespace std;
  
  class Character 
  {
      protected:
  
      int Health = 100;
      int attackpower;
  
      public:
  
      void setAttackPower(int attack) {
          attackpower = attack;
      }
  };
  
  class Ninja: public Character
  {
      public:
  
      void attack() {
          cout &lt;&lt; "Ninja attacks your character! - " &lt;&lt; attackpower &lt;&lt; " Points!" &lt;&lt; endl;
      }
  };
  
  class Dragon: public Character
  {
      public:
  
      void attack() {
          cout &lt;&lt; "Dragon attacks your character! - " &lt;&lt; attackpower &lt;&lt; " Points!" &lt;&lt; endl;
      }
  };
  </code></pre>