class Myclass { protected: int x; }; class derived : public Myclass { public: void f( Myclass& obj ) { obj.x = 5; } }; int main() { return 0; }
Standard input is empty
prog.cpp: In member function ‘void derived::f(Myclass&)’: prog.cpp:4: error: ‘int Myclass::x’ is protected prog.cpp:13: error: within this context
Standard output is empty