При компиляции этого чудовищно сложного кода возникает ошибка: error: 'Base' is an inaccessible base of 'Derived'
#include <iostream>
//-------------------------------------------------------------------------
struct Base
{
};
//-------------------------------------------------------------------------
struct Derived : protected Base
{
operator Base* ()
{ return static_cast<Base*>(this); }
Derived* operator & ()
{ return this; }
};
//-------------------------------------------------------------------------
int main(int argc,char** argv)
{
Derived derived;
Base* pbase = static_cast<Base*>(&derived);
return 0;
}
struct Derived : protected Base
{
Derived& operator & ()
{ return *this; }
};