fork download
  1. struct B {};
  2. struct D : private B {
  3. B* foo () { return new D; } // ok
  4. };
  5. struct DD : public D {
  6. B* foo () { return 0; } // error: ‘struct B B::B’ is inaccessible
  7. };
  8.  
  9. int main ()
  10. {
  11. B *p = 0; // ok
  12. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:1: error: ‘struct B’ is inaccessible
prog.cpp:6: error: within this context
prog.cpp: In function ‘int main()’:
prog.cpp:11: warning: unused variable ‘p’
stdout
Standard output is empty