#include <iostream>
struct A {
A() { std::cout << "A()" << std::endl; }
};
struct B : A {
B() { std::cout << "B()" << std::endl; }
B(const B& b) { std::cout << "B(const B& b)" << std::endl; }
};
struct C : A {
C() { std::cout << "C()" << std::endl; }
C(const C& c) : A(c) { std::cout << "C(const C& c)" << std::endl; }
};
int main() {
std::cout << "Construct b1" << std::endl;
B b1;
std::cout << std::endl << "Construct b2" << std::endl;
B b2(b1);
std::cout << std::endl << "Construct c1" << std::endl;
C c1;
std::cout << std::endl << "Construct c2" << std::endl;
C c2(c1);
}
I2luY2x1ZGUgPGlvc3RyZWFtPgoKc3RydWN0IEEgewoJQSgpIHsgc3RkOjpjb3V0IDw8ICJBKCkiIDw8IHN0ZDo6ZW5kbDsgfQp9OwoKc3RydWN0IEIgOiBBIHsKCUIoKSB7IHN0ZDo6Y291dCA8PCAiQigpIiA8PCBzdGQ6OmVuZGw7IH0KCUIoY29uc3QgQiYgYikgeyBzdGQ6OmNvdXQgPDwgIkIoY29uc3QgQiYgYikiIDw8IHN0ZDo6ZW5kbDsgfQp9OwoKc3RydWN0IEMgOiBBIHsKCUMoKSB7IHN0ZDo6Y291dCA8PCAiQygpIiA8PCBzdGQ6OmVuZGw7IH0KCUMoY29uc3QgQyYgYykgOiBBKGMpIHsgc3RkOjpjb3V0IDw8ICJDKGNvbnN0IEMmIGMpIiA8PCBzdGQ6OmVuZGw7IH0KfTsKCmludCBtYWluKCkgewoJc3RkOjpjb3V0IDw8ICJDb25zdHJ1Y3QgYjEiIDw8IHN0ZDo6ZW5kbDsKCUIgYjE7CglzdGQ6OmNvdXQgPDwgc3RkOjplbmRsIDw8ICJDb25zdHJ1Y3QgYjIiIDw8IHN0ZDo6ZW5kbDsKCUIgYjIoYjEpOwoJCglzdGQ6OmNvdXQgPDwgc3RkOjplbmRsIDw8ICJDb25zdHJ1Y3QgYzEiIDw8IHN0ZDo6ZW5kbDsKCUMgYzE7CglzdGQ6OmNvdXQgPDwgc3RkOjplbmRsIDw8ICJDb25zdHJ1Y3QgYzIiIDw8IHN0ZDo6ZW5kbDsKCUMgYzIoYzEpOwp9