struct S {public: int x;}; class C : S {}; int main() { C c; c.x; // Inaccessible, since C is declared with the class keyword, // even though S was declared with the struct keyword. return 0;}
Standard input is empty
prog.cpp: In function 'int main()': prog.cpp:3:6: error: 'int S::x' is inaccessible int x; ^ prog.cpp:10:4: error: within this context c.x; // Inaccessible, since C is declared with the class keyword, ^
Standard output is empty
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!