#include <iostream>
using namespace std;
class Base {
public:
virtual ~Base() { std::cout << "Base destructor called.\n"; }
};
class Derived : public Base {
public:
~Derived() { std::cout << "Derived destructor called.\n"; }
};
int main() {
Base* pBase = new Derived();
delete pBase;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKCmNsYXNzIEJhc2UgewpwdWJsaWM6CiAgICB2aXJ0dWFsIH5CYXNlKCkgeyBzdGQ6OmNvdXQgPDwgIkJhc2UgZGVzdHJ1Y3RvciBjYWxsZWQuXG4iOyB9Cn07CgpjbGFzcyBEZXJpdmVkIDogcHVibGljIEJhc2UgewpwdWJsaWM6CiAgICB+RGVyaXZlZCgpIHsgc3RkOjpjb3V0IDw8ICJEZXJpdmVkIGRlc3RydWN0b3IgY2FsbGVkLlxuIjsgfQp9OwoKaW50IG1haW4oKSB7CiAgICBCYXNlKiBwQmFzZSA9IG5ldyBEZXJpdmVkKCk7CiAgICBkZWxldGUgcEJhc2U7CiAgICByZXR1cm4gMDsKfQo=