Why do virtual destructors behave the way they do?
<p>I read that that virtual destructors must be declared in classes that have virtual methods. I just cant understand why they must be declared virtual. I know why we need to have virtual destructors as from the following example. I just wanted to know why compilers dont manage virtual destructors for us. Is there something I need to know about working of virtual destructors ?
The following example shows that if destructors are not declared virtual the destructors of derived class are not called why is that ?</p>

<pre><code>class Base 
{
    // some virtual methods
public:
    Base()
    {std::cout &lt;&lt; "Base Constructor\n";}
    ~Base()
    {std::cout &lt;&lt; "Base De-structor\n";}

};

class Derived : public Base
{
public:
    Derived()
    {std::cout &lt;&lt; "Der constructor\n";}
    ~Derived()
    { std::cout &lt;&lt; "Der De-structor\n";}
} ;         
void main()
{

    Base *b = new Derived();
    delete b;
}
</code></pre>
