title: How/when do I use a virtual destructor?
body: <p>I'm currently writing a program with the following polymorphic hierarchy: Base: Multinumber. Derived: Pairs, Complex, Rational. Multinumber is a virtual class and is never instantiated.</p>
  
  <p>During the course of my program I frequently dynamically manage the base classes so I need a destructor. My question is this: how do I make the destructor virtual? In my Multinumber.h file right now I have this: </p>
  
  <pre><code>  virtual ~Multinumber();
  </code></pre>
  
  <p>In my Multinumber.cpp:</p>
  
  <pre><code>Multinumber::~Multinumber()
  {
  }
  </code></pre>
  
  <p>And in all of my derived classes I have this:</p>
  
  <pre><code>Rational::~Rational()
  {
  }
  </code></pre>
  
  <p>I have nothing in any of my derived.h files. Unfortunately, this does not compile. Rather, I get this error:</p>
  
  <pre><code>Complex.cpp|75|error: definition of implicitly-declared 'virtual Complex::~Complex()'
  </code></pre>
  
  <p>What is wrong with my syntax? Thanks for any help you can give me.</p>