#include <iostream>
class Base
{
public:
virtual ~Base() { std::cout << "~Base" << std::endl; }
};
class Derived : public Base
{
public:
virtual ~Derived() { std::cout << "~Derived" << std::endl; }
};
int main()
{
Base *bp = new Derived;
delete bp;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgoKY2xhc3MgQmFzZQp7CnB1YmxpYzoKICB2aXJ0dWFsIH5CYXNlKCkgeyBzdGQ6OmNvdXQgPDwgIn5CYXNlIiA8PCBzdGQ6OmVuZGw7IH0KfTsKCmNsYXNzIERlcml2ZWQgOiBwdWJsaWMgQmFzZQp7CnB1YmxpYzoKICB2aXJ0dWFsIH5EZXJpdmVkKCkgeyBzdGQ6OmNvdXQgPDwgIn5EZXJpdmVkIiA8PCBzdGQ6OmVuZGw7IH0KfTsKCmludCBtYWluKCkKewogIEJhc2UgKmJwID0gbmV3IERlcml2ZWQ7CiAgZGVsZXRlIGJwOwogIHJldHVybiAwOwp9