title: Implementing IDisposable on a subclass when the parent also implements IDisposable
body: <p>I have a parent and child class that both need to implement <code>IDisposable</code>.  Where should <code>virtual</code> (and <code>base.Dispose()</code>?) calls come into play?  When I just override the <code>Dispose(bool disposing)</code> call, it feels really strange stating that I implement <code>IDisposable</code> without having an explicit <code>Dispose()</code> function (just utilizing the inherited one), but having everything else.</p>
  
  <p>What I had been doing (trivialized quite a bit):</p>
  
  <pre><code>internal class FooBase : IDisposable
  {
      Socket baseSocket;
  
      private void SendNormalShutdown() { }
  
      public void Dispose()
      {
          Dispose(true);
          GC.SuppressFinalize(this);
      }
  
      private bool _disposed = false;
      protected virtual void Dispose(bool disposing)
      {
          if (!_disposed)
          {
              if (disposing)
              {
                  SendNormalShutdown();
              }
              baseSocket.Close();
          }
      }
  
      ~FooBase()
      {
          Dispose(false);
      }
  }
  
  internal class Foo : FooBase, IDisposable
  {
      Socket extraSocket;
  
      private bool _disposed = false;
      protected override void Dispose(bool disposing)
      {
          if (!_disposed)
          {
              extraSocket.Close();
          }
          base.Dispose(disposing);
      }
  
      ~Foo()
      {
          Dispose(false);
      }
  
  }
  </code></pre>