fork(7) download
  1. class Myclass
  2. {
  3. protected:
  4. int x;
  5. };
  6.  
  7.  
  8. class derived : public Myclass
  9. {
  10. public:
  11. void f( Myclass& obj )
  12. {
  13. obj.x = 5;
  14. }
  15. };
  16.  
  17. int main()
  18. {
  19. return 0;
  20. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
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
stdout
Standard output is empty