#include <iostream>
using namespace std;
class Base
{
public:
Base()
{
cout << "Base()\n";
}
Base(int)
{
cout << "Base(int)\n";
}
~Base()
{
cout << "~Base()\n";
}
Base& operator=(int)
{
cout << "Base::operator=(int)\n";
return *this;
}
};
class Derived : public Base
{
public:
Derived()
{
cout << "Derived()\n";
}
Derived(int n) : Base(n)
{
cout << "Derived(int)\n";
}
~Derived()
{
cout << "~Derived()\n";
}
};
class Holder
{
public:
Holder(int n)
{
member = n;
}
Derived member;
};
int main(int argc, char* argv[])
{
cout << "Start\n";
Holder obj(1);
cout << "Finish\n";
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKY2xhc3MgQmFzZQp7CnB1YmxpYzoKICAgQmFzZSgpCiAgIHsKICAgICAgY291dCA8PCAiQmFzZSgpXG4iOwogICB9CgogICBCYXNlKGludCkKICAgewogICAgICBjb3V0IDw8ICJCYXNlKGludClcbiI7CiAgIH0KCiAgIH5CYXNlKCkKICAgewogICAgICBjb3V0IDw8ICJ+QmFzZSgpXG4iOwogICB9CgogICBCYXNlJiBvcGVyYXRvcj0oaW50KQogICB7CiAgICAgIGNvdXQgPDwgIkJhc2U6Om9wZXJhdG9yPShpbnQpXG4iOwogICAgICByZXR1cm4gKnRoaXM7CiAgIH0KfTsKCmNsYXNzIERlcml2ZWQgOiBwdWJsaWMgQmFzZQp7CnB1YmxpYzoKICAgRGVyaXZlZCgpCiAgIHsKICAgICAgY291dCA8PCAiRGVyaXZlZCgpXG4iOwogICB9CgogICBEZXJpdmVkKGludCBuKSA6IEJhc2UobikKICAgewogICAgICBjb3V0IDw8ICJEZXJpdmVkKGludClcbiI7CiAgIH0KCiAgIH5EZXJpdmVkKCkKICAgewogICAgICBjb3V0IDw8ICJ+RGVyaXZlZCgpXG4iOwogICB9Cn07CgpjbGFzcyBIb2xkZXIKewpwdWJsaWM6CiAgIEhvbGRlcihpbnQgbikKICAgewogICAgICBtZW1iZXIgPSBuOwogICB9CgogICBEZXJpdmVkIG1lbWJlcjsKfTsKCmludCBtYWluKGludCBhcmdjLCBjaGFyKiBhcmd2W10pCnsKICAgY291dCA8PCAiU3RhcnRcbiI7CiAgIEhvbGRlciBvYmooMSk7CiAgIGNvdXQgPDwgIkZpbmlzaFxuIjsKCiAgIHJldHVybiAwOwp9Cg==