#include <iostream>
using namespace std;
class Base {
protected:
static void call_foo(Base* base) { base->foo(); }
private:
virtual void foo() = 0;
};
class Derived : public Base {
private:
Base *b;
protected:
virtual void foo() { /* Some implementation */ };
virtual void foo2() {
// b->foo(); // doesn't work
call_foo(b); // works
}
};
int main() {
// your code goes here
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKY2xhc3MgQmFzZSB7CnByb3RlY3RlZDoKICAgc3RhdGljIHZvaWQgY2FsbF9mb28oQmFzZSogYmFzZSkgeyBiYXNlLT5mb28oKTsgfQpwcml2YXRlOgogICB2aXJ0dWFsIHZvaWQgZm9vKCkgPSAwOwp9OwoKY2xhc3MgRGVyaXZlZCA6IHB1YmxpYyBCYXNlIHsKcHJpdmF0ZToKICAgIEJhc2UgKmI7CnByb3RlY3RlZDoKICAgIHZpcnR1YWwgdm9pZCBmb28oKSB7IC8qIFNvbWUgaW1wbGVtZW50YXRpb24gKi8gfTsKICAgIHZpcnR1YWwgdm9pZCBmb28yKCkgewogICAgCS8vIGItPmZvbygpOyAvLyBkb2Vzbid0IHdvcmsKICAgICAgICBjYWxsX2ZvbyhiKTsgLy8gd29ya3MKICAgIH0KfTsKCmludCBtYWluKCkgewoJLy8geW91ciBjb2RlIGdvZXMgaGVyZQoJcmV0dXJuIDA7Cn0=