#include using std::cout; using std::endl; struct X { X() { cout << "X::X()" << endl; } virtual ~X() { cout << "X::~X()" << endl; } }; struct Y : X { Y() { cout << "Y::Y()" << endl; } virtual ~Y() { cout << "Y::~Y()" << endl; } }; int main() { Y* y = new Y; delete y; cout << endl; // Ohne virtual X::~X Verhalten undefiniert X* x = new Y; delete x; }