#include <iostream>
class Mother
{
public:
virtual void foo1() { }
int a;
};
class Father
{
public:
virtual void foo2() { }
int b;
};
class Child : public Mother, public Father
{
public:
int c;
};
int main()
{
Child c;
Mother* m = &c;
Father* f = &c;
if ((void*)&c == (void*)m)
{
std::cout << "I like Mother." << std::endl;
}
if ((void*)&c == (void*)f)
{
std::cout << "I like Father." << std::endl;
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgoKY2xhc3MgTW90aGVyCnsKcHVibGljOgogICAgdmlydHVhbCB2b2lkIGZvbzEoKSB7IH0KICAgIGludCBhOwp9OwoKY2xhc3MgRmF0aGVyCnsKcHVibGljOgogICAgdmlydHVhbCB2b2lkIGZvbzIoKSB7IH0KICAgIGludCBiOwp9OwoKY2xhc3MgQ2hpbGQgOiBwdWJsaWMgTW90aGVyLCBwdWJsaWMgRmF0aGVyCnsKcHVibGljOgogICAgaW50IGM7Cn07CgppbnQgbWFpbigpCnsKICAgIENoaWxkIGM7CiAgICBNb3RoZXIqIG0gPSAmYzsKICAgIEZhdGhlciogZiA9ICZjOwogICAgCiAgICBpZiAoKHZvaWQqKSZjID09ICh2b2lkKiltKQogICAgewogICAgICAgIHN0ZDo6Y291dCA8PCAiSSBsaWtlIE1vdGhlci4iIDw8IHN0ZDo6ZW5kbDsKICAgIH0KICAgIAogICAgaWYgKCh2b2lkKikmYyA9PSAodm9pZCopZikKICAgIHsKICAgICAgICBzdGQ6OmNvdXQgPDwgIkkgbGlrZSBGYXRoZXIuIiA8PCBzdGQ6OmVuZGw7CiAgICB9CiAgICAKICAgIHJldHVybiAwOwp9