title: Is it possible to override a method with a derived parameter instead of a base one?
body: <p>I'm stuck in this situation where:</p>
  
  <ol>
  <li>I have an abstract class called <strong><code>Ammo</code></strong>, with <code>AmmoBox</code> and <code>Clip</code> as children.</li>
  <li>I have an abstract class called <code>Weapon</code>, with <code>Firearm</code> and <code>Melee</code> as children.</li>
  <li><code>Firearm</code> is abstract, with <code>ClipWeapon</code> and <code>ShellWeapon</code> as children.</li>
  <li>Inside <code>Firearm</code>, there's a <code>void Reload(Ammo ammo);</code></li>
  </ol>
  
  <p>The problem is that, a <code>ClipWeapon</code> could use both a <code>Clip</code> and an <code>AmmoBox</code> to reload:</p>
  
  <pre><code>public override void Reload(Ammo ammo)
  {
      if (ammo is Clip)
      {
          SwapClips(ammo as Clip);
      }
      else if (ammo is AmmoBox)
      {
          var ammoBox = ammo as AmmoBox;
          // AddBullets returns how many bullets has left from its parameter
          ammoBox.Set(clip.AddBullets(ammoBox.nBullets));
      }
  }
  </code></pre>
  
  <p>But a <code>ShellWeapon</code>, could only use an <code>AmmoBox</code> to reload. I could do this:</p>
  
  <pre><code>public override void Reload(Ammo ammo)
  {
      if (ammo is AmmoBox)
      {
          // reload...
      }
  }
  </code></pre>
  
  <p>But this is bad because, even though I'm checking to make sure it's of type <code>AmmoBox</code>, from the outside, it appears like a <code>ShellWeapon</code> could take a <code>Clip</code> as well, since a <code>Clip</code> is <code>Ammo</code> as well.</p>
  
  <p>Or, I could remove <code>Reload</code> from <code>Firearm</code>, and put it both <code>ClipWeapon</code> and <code>ShellWeapon</code> with the specific params I need, but doing so I will lose the benefits of Polymorphism, which is not what I want to.</p>
  
  <p>Wouldn't it be optimal, if I could override <code>Reload</code> inside <code>ShellWeapon</code> like this:</p>
  
  <pre><code>public override void Reload(AmmoBox ammoBox)
  {
     // reload ... 
  }
  </code></pre>
  
  <p>Of course I tried it, and it didn't work, I got an error saying the signature must match or something, but shouldn't this be valid 'logically'? since <code>AmmoBox</code> is a <code>Ammo</code>?</p>
  
  <p>How should I get around this? And in general, is my design correct?
  (Note I was using interfaces <code>IClipWeapon</code> and <code>IShellWeapon</code> but I ran into trouble, so I moved to using classes instead)</p>
  
  <p>Thanks in advance.</p>