|
Attention aux opérations magiques du compilateur:
struct a {
virtual void print() { cout << "Je suis un a" << endl; }
~a();
}
struct b: public a {
void print() { cout << "Je suis un b" << endl; }
static char _storage[sizeof(b)];
void *operator new(size_t) { return _storage; }
~b();
};
b *un = new b, *deux = new b;
delete un;
deux -> print(); // Je suis un a
|