title: Replace Conditional with Polymorphism - How to handle when your type changes?
body: <p>For a personal project, I'm working on a small web-based game. </p>
  
  <p>I have a <code>Card</code> class that has a <code>Status</code> property, and there are case statements all over the place. I thought, hey, this is a great oppurtunity for <a href="http://martinfowler.com/refactoring/catalog/replaceConditionalWithPolymorphism.html" rel="nofollow">Replace Conditional with Polymorphism</a>!</p>
  
  <p>The problem is, I have a couple methods that do stuff like this:</p>
  
  <pre><code>public class Card
  {
      public void ChangeStatus()
      {
        switch (Status)
        {
          case MyStatusEnum.Normal:
            Status = MyStatusEnum.Underwater;
            break;
          case MyStatusEnum.Underwater:
            Status = MyStatusEnum.Dead;
            break;
          // etc...
        }
      }
  }
  </code></pre>
  
  <p>When refactoring it in the new <code>NormalCard</code> class, I'm overriding the <code>ChangeStatus</code> method like this:</p>
  
  <pre><code>public override void ChangeStatus()
  {
      base.Status = MyStatusEnum.Underwater;
  }
  </code></pre>
  
  <p>The problem is this object of <code>NormalCard</code> has a status of <code>Underwater</code>.  I can't reassign the type of <code>this</code>, and I don't really want to change the return of the methods from <code>void</code> to <code>CardBase</code>.  What options do I have?  Is there a standard way of doing this?</p>
  
  <p><strong>Edit</strong> Tormod set me straight.  I want the <a href="http://en.wikibooks.org/wiki/Computer_Science_Design_Patterns/State" rel="nofollow">State Pattern</a>. Thanks all!</p>