#include <iostream>
using namespace std;
struct Base
{
void foo() const {
cout << "Base::foo()\n";
}
};
struct Derived : private Base
{
const Base* get() const {
return this;
}
};
int main()
{
Derived d;
//const Base *b = &d; //uncomment to get error
const Base *b = d.get();
b->foo();
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKc3RydWN0IEJhc2UKewogICAgdm9pZCBmb28oKSBjb25zdCB7CiAgICAgICAgY291dCA8PCAiQmFzZTo6Zm9vKClcbiI7CiAgICB9Cn07CgpzdHJ1Y3QgRGVyaXZlZCA6IHByaXZhdGUgQmFzZQp7CiAgICBjb25zdCBCYXNlKiBnZXQoKSBjb25zdCB7CiAgICAgICAgcmV0dXJuIHRoaXM7CiAgICB9Cn07CgppbnQgbWFpbigpCnsKICAgIERlcml2ZWQgZDsKICAgIC8vY29uc3QgQmFzZSAqYiA9ICZkOyAvL3VuY29tbWVudCB0byBnZXQgZXJyb3IKICAgIGNvbnN0IEJhc2UgKmIgPSBkLmdldCgpOwogICAgYi0+Zm9vKCk7Cn0=