struct B {}; struct D : private B { B* foo () { return new D; } // ok }; struct DD : public D { B* foo () { return 0; } // error: ‘struct B B::B’ is inaccessible }; int main () { B *p = 0; // ok }
Standard input is empty
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’
Standard output is empty
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!