Virtual base destructor
<p>I have a problem as below:</p>

<pre><code>#include &lt;iostream&gt;
using namespace std;

class B {
public:
        B() {
            cout &lt;&lt; "Base Constructor \n" ;
        }
        virtual ~B() {
            cout &lt;&lt; "Base Destructor \n" ;
        }
};

class D : public B {
public:
        D(string s):str(s) {
            cout &lt;&lt; "Derived Constructor \n" ;
        }
        ~D() {
            cout &lt;&lt; "Derived Destructor \n" ;
        }
private:
        string str;
};

int main() {
        B *b = new D("derived");
        delete b;
}
</code></pre>

<p>As a post <a href="http://www.bogotobogo.com/cplusplus/virtualfunctions.php" rel="nofollow">here</a></p>

<p>The result is:</p>

<pre><code>Base Constructor
Derived Constructor
Derived Destructor
Base Destructor
</code></pre>

<p>But when I run the progam by Dev-C++ and Eclipse CDT, it always throws Runtime error.
I cannot explain why. Please help me</p>
