#include <iostream>
struct A
{
A(){ std::cout << "A default ctor" << std::endl; }
A(A const&){ std::cout << "A copy ctor" << std::endl; }
virtual ~A() = 0;
}; A::~A(){}
struct B : virtual A
{
B(){ std::cout << "B default ctor" << std::endl; }
B(B const&o) : A(o) { std::cout << "B copy ctor" << std::endl; }
virtual ~B() = 0;
}; B::~B(){}
struct C : virtual A
{
C(){ std::cout << "C default ctor" << std::endl; }
C(C const&o) : A(o) { std::cout << "C copy ctor" << std::endl; }
virtual ~C() = 0;
}; C::~C(){}
struct D : B, C
{
D(){ std::cout << "D default ctor" << std::endl; }
D(D const&o) : A(o), B(o), C(o) { std::cout << "D copy ctor" << std::endl; }
virtual ~D() = 0;
}; D::~D(){}
struct E : D
{
E(){ std::cout << "E default ctor" << std::endl; }
E(E const&o) : A(o), D(o) { std::cout << "E copy ctor" << std::endl; }
virtual ~E(){}
};
int main()
{
E e;
std::cout << std::endl << std::endl;
E e2(e);
}
I2luY2x1ZGUgPGlvc3RyZWFtPgoKc3RydWN0IEEKewogICAgQSgpeyBzdGQ6OmNvdXQgPDwgIkEgZGVmYXVsdCBjdG9yIiA8PCBzdGQ6OmVuZGw7IH0KICAgIEEoQSBjb25zdCYpeyBzdGQ6OmNvdXQgPDwgIkEgY29weSBjdG9yIiA8PCBzdGQ6OmVuZGw7IH0KICAgIHZpcnR1YWwgfkEoKSA9IDA7Cn07IEE6On5BKCl7fQoKc3RydWN0IEIgOiB2aXJ0dWFsIEEKewogICAgQigpeyBzdGQ6OmNvdXQgPDwgIkIgZGVmYXVsdCBjdG9yIiA8PCBzdGQ6OmVuZGw7IH0KICAgIEIoQiBjb25zdCZvKSA6IEEobykgeyBzdGQ6OmNvdXQgPDwgIkIgY29weSBjdG9yIiA8PCBzdGQ6OmVuZGw7IH0KICAgIHZpcnR1YWwgfkIoKSA9IDA7Cn07IEI6On5CKCl7fQpzdHJ1Y3QgQyA6IHZpcnR1YWwgQQp7CiAgICBDKCl7IHN0ZDo6Y291dCA8PCAiQyBk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