title: Override Destructor C++
body: <p>From the C++ FAQ:</p>
  
  <blockquote>
    <p>[11.4] Can I overload the destructor for my class?
    No.</p>
  </blockquote>
  
  <p>I realize this means you cannot change the return type, arguments' types nor the number of arguments. I may be splitting hairs on the syntax of the words, but is it possible to <em>override</em> the Parent's destructor?</p>
  
  <pre><code>class Child : public Parent {
  public:
      virtual Parent::~Parent() {
          // New definition
      }
  };
  </code></pre>
  
  <p>And for that matter do it recursively?</p>
  
  <pre><code>class Grandchild : public Child {
  public:
      Child::Parent::~Parent() {
          // An even newer definition
      }
  };
  </code></pre>
  
  <p>I've read <a href="https://stackoverflow.com/questions/14184341/c-constructor-destructor-inheritance">this</a> and a <a href="https://stackoverflow.com/questions/2198379/are-virtual-destructors-inherited">related post</a> and it makes me think because destructors are not inherited, they cannot be overridden, but I've never seen it explicitly stated.</p>
  
  <p>EDIT: I changed this to reflect the fact that I want to override the Parent's destructor, note Child and Grandchild overriding ~Parent().</p>
  
  <p>The main reason I am doing this is to maintain Parent's interface while changing the way it is destroyed (the entire reason for the child class). I will have something else managing all Parent's created and will explicitly call their destructors at a later time of my choosing.</p>