#include <iostream>

using namespace std;

class B
{
public:
    B()
    {
    }

    virtual void breakHorribly()
    {
        cout << "still alive" << endl;
        //((A *) this)->breakHorribly();
        cout << "still alive" << endl;
        doSomethingDiabolical();
        cout << "still alive" << endl;
        doSomethingDiabolical();
        cout << "dead" << endl;
    }

    virtual void doSomethingDiabolical() = 0;
};

class A : public B
{
public:
    A() : B()
    {
    }

    void doSomethingDiabolical()
    {
        cout << "something terrible happened!" << endl;
        doSomethingDiabolical();
        delete this;
    }
};

int main()
{
    cout << "still alive" << endl;
    B * o = new A[10];
    cout << "still alive" << endl;
    o->breakHorribly();
}