title: How does the derived class destructor get invoked being private in the following program?
body: <pre><code>#include&lt;iostream&gt;
  
  class base
  {
     public:
         virtual ~base(){std::cout &lt;&lt; "base\n";}
  };
  class derived : public base
  {
     private:
          ~derived(){std::cout &lt;&lt; "derived\n";} /* destructor is private */
  };
  int main()
  {
        base *pt= new derived;
        delete pt;
  }
  </code></pre>
  
  <p><strong>The above program compiles and runs fine.</strong>
  How does the derived class destructor get invoked being private ?</p>