#include <vector>
#include <algorithm>
class Foo;
class BaseA {
protected:
bool hasChild() const { return !childs_.empty(); }
std::vector<Foo> childs_;
};
class BaseB {
protected:
bool hasChild() const { return false; }
};
class Foo : public BaseA, public BaseB {
public:
bool hasGrandChild() const {
return std::any_of(childs_.begin(), childs_.end(), [](Foo const &foo) {
return foo.BaseA::hasChild();
});
}
};
int main()
{
Foo foo;
foo.hasGrandChild();
return 0;
}
I2luY2x1ZGUgPHZlY3Rvcj4KI2luY2x1ZGUgPGFsZ29yaXRobT4KCmNsYXNzIEZvbzsKCmNsYXNzIEJhc2VBIHsKcHJvdGVjdGVkOgogICAgYm9vbCBoYXNDaGlsZCgpIGNvbnN0IHsgcmV0dXJuICFjaGlsZHNfLmVtcHR5KCk7IH0KICAgIHN0ZDo6dmVjdG9yPEZvbz4gY2hpbGRzXzsKfTsKCmNsYXNzIEJhc2VCIHsKcHJvdGVjdGVkOgogICAgYm9vbCBoYXNDaGlsZCgpIGNvbnN0IHsgcmV0dXJuIGZhbHNlOyB9Cn07CgpjbGFzcyBGb28gOiBwdWJsaWMgQmFzZUEsIHB1YmxpYyBCYXNlQiB7CnB1YmxpYzoKICBib29sIGhhc0dyYW5kQ2hpbGQoKSBjb25zdCB7CiAgICByZXR1cm4gc3RkOjphbnlfb2YoY2hpbGRzXy5iZWdpbigpLCBjaGlsZHNfLmVuZCgpLCBbXShGb28gY29uc3QgJmZvbykgewogICAgICAgIHJldHVybiBmb28uQmFzZUE6Omhhc0NoaWxkKCk7CiAgICAgIH0pOwogIH0gIAp9OwogCmludCBtYWluKCkKewogIEZvbyBmb287CiAgZm9vLmhhc0dyYW5kQ2hpbGQoKTsKICByZXR1cm4gMDsKfQ==