#include <iostream>
class Base
{
public:
Base()
{
std::cout << "Base::Base() \n";
}
~Base()
{
std::cout << "Base::~Base() \n";
}
};
class Derived : public Base
{
public:
Derived()
{
std::cout << "Derived::Derived() \n";
}
~Derived()
{
std::cout << "Derived::~Derived() \n";
}
};
void foo(Base) {}
int main()
{
Derived instance;
foo(instance);
}
I2luY2x1ZGUgPGlvc3RyZWFtPgogCmNsYXNzIEJhc2UKewpwdWJsaWM6CiAgICBCYXNlKCkKICAgIHsKICAgICAgICBzdGQ6OmNvdXQgPDwgIkJhc2U6OkJhc2UoKSBcbiI7CiAgICB9CiAgICAKICAgIH5CYXNlKCkKICAgIHsKICAgICAgICBzdGQ6OmNvdXQgPDwgIkJhc2U6On5CYXNlKCkgXG4iOwogICAgfQp9OwogCmNsYXNzIERlcml2ZWQgOiBwdWJsaWMgQmFzZQp7CnB1YmxpYzoKICAgIERlcml2ZWQoKQogICAgewogICAgICAgIHN0ZDo6Y291dCA8PCAiRGVyaXZlZDo6RGVyaXZlZCgpIFxuIjsKICAgIH0KICAgIAogICAgfkRlcml2ZWQoKQogICAgewogICAgICAgIHN0ZDo6Y291dCA8PCAiRGVyaXZlZDo6fkRlcml2ZWQoKSBcbiI7CiAgICB9Cn07CiAKdm9pZCBmb28oQmFzZSkge30KIAppbnQgbWFpbigpCnsKICAgIERlcml2ZWQgaW5zdGFuY2U7CiAgICBmb28oaW5zdGFuY2UpOwp9