#include <iostream>
class A
{
std::string k;
int j;
public:
A() { std::cout << "ctor A" << std::endl;};
~A() { std::cout << "dtor A" << std::endl;};
};
class B : public virtual A
{
public:
B() { std::cout << "ctor B" << std::endl;};
~B() {std::cout << "dtor B" << std::endl;};
};
int main()
{
{
std::cout << "building an A obj" << std::endl;
A a;
}
{
std::cout << "building a B obj" << std::endl;
B b;
}
return(0);
}
I2luY2x1ZGUgPGlvc3RyZWFtPgoKY2xhc3MgQQp7CiAgICBzdGQ6OnN0cmluZyBrOwogICAgaW50IGo7CiAgcHVibGljOgogICAgQSgpIHsgc3RkOjpjb3V0IDw8ICJjdG9yIEEiIDw8IHN0ZDo6ZW5kbDt9OwogICAgfkEoKSB7IHN0ZDo6Y291dCA8PCAiZHRvciBBIiA8PCBzdGQ6OmVuZGw7fTsKfTsKCmNsYXNzIEIgOiBwdWJsaWMgdmlydHVhbCBBCnsKICBwdWJsaWM6CiAgICBCKCkgeyBzdGQ6OmNvdXQgPDwgImN0b3IgQiIgPDwgc3RkOjplbmRsO307CiAgICB+QigpIHtzdGQ6OmNvdXQgPDwgImR0b3IgQiIgPDwgc3RkOjplbmRsO307Cn07CgppbnQgbWFpbigpCnsKICB7CiAgICBzdGQ6OmNvdXQgPDwgImJ1aWxkaW5nIGFuIEEgb2JqIiA8PCBzdGQ6OmVuZGw7CiAgICBBIGE7CiAgfQogIHsKICAgIHN0ZDo6Y291dCA8PCAiYnVpbGRpbmcgYSAgQiBvYmoiIDw8IHN0ZDo6ZW5kbDsKICAgIEIgYjsKICB9CiAgcmV0dXJuKDApOwp9