#include <cstdio>
class Base1 {
public:
int func1() { return var1 = 1; }
int var1;
};
class Base2 {
public:
int func2() { return var2 = 2; }
int var2;
};
class Derived : public Base1, public Base2 {
public:
int func() { return var = func1() + func2(); }
int var;
};
int main() {
Derived o;
std::printf("%d %d %d\n", o.func1(), o.func2(), o.func());
std::printf("%d %d %d %p %p %p\n", o.var1, o.var2, o.var, &o.var1, &o.var2, &o.var);
std::printf("%p %p %p\n", &o, static_cast<Base1*>(&o), static_cast<Base2*>(&o));
return 0;
}
I2luY2x1ZGUgPGNzdGRpbz4KCmNsYXNzIEJhc2UxIHsKcHVibGljOgogICAgaW50IGZ1bmMxKCkgeyByZXR1cm4gdmFyMSA9IDE7IH0KICAgIGludCB2YXIxOwp9OwoKY2xhc3MgQmFzZTIgewpwdWJsaWM6CiAgICBpbnQgZnVuYzIoKSB7IHJldHVybiB2YXIyID0gMjsgfQogICAgaW50IHZhcjI7Cn07CgpjbGFzcyBEZXJpdmVkIDogcHVibGljIEJhc2UxLCBwdWJsaWMgQmFzZTIgewpwdWJsaWM6CiAgICBpbnQgZnVuYygpIHsgcmV0dXJuIHZhciA9IGZ1bmMxKCkgKyBmdW5jMigpOyB9CiAgICBpbnQgdmFyOwp9OwoKaW50IG1haW4oKSB7CiAgICBEZXJpdmVkIG87CglzdGQ6OnByaW50ZigiJWQgJWQgJWRcbiIsIG8uZnVuYzEoKSwgby5mdW5jMigpLCBvLmZ1bmMoKSk7CglzdGQ6OnByaW50ZigiJWQgJWQgJWQgJXAgJXAgJXBcbiIsIG8udmFyMSwgby52YXIyLCBvLnZhciwgJm8udmFyMSwgJm8udmFyMiwgJm8udmFyKTsKICAgIHN0ZDo6cHJpbnRmKCIlcCAlcCAlcFxuIiwgJm8sIHN0YXRpY19jYXN0PEJhc2UxKj4oJm8pLCBzdGF0aWNfY2FzdDxCYXNlMio+KCZvKSk7CglyZXR1cm4gMDsKfQ==