title: How can I make an instant-dependant static variabe in a class method?
body: <p>I have a function in a class the more or less works like so:</p>
  
  <pre><code>class Player {
  private:
      Object* minions[16]
  public:
      void Summon(Object* obj);
  };
  
  Player::Summon(Object* obj) {
      static int i = 0;
      if (i == 16)
          return;
      minions[i] = obj;
      i++;
  }
  </code></pre>
  
  <p>The problem arise when trying to use more than one player, like so:</p>
  
  <pre><code>Player playerone;
  Player playerthree;
  playerone.Summon(new Object("o1"));
  playerthree.Summon(new Object("o2"));
  </code></pre>
  
  <p><code>o1</code> is located in <code>playerone.minions[0]</code>, as is expected, however, <code>o2</code> is located in <code>playerthree.minions[1]</code>, the <code>Summon()</code> function using the same <code>i</code> variable.  Is there a way to make the <code>Summon()</code> function use a static <code>i</code> variable for a single instance, but use separate <code>i</code> variables for each instance?  I know I could do something like make a <code>for</code> loop to the first spot in <code>minions[]</code> equal to <code>NULL</code>, or make <code>i</code> a member of <code>Player</code> directly, but I want to know if there is a better way before I do either of those.</p>