#include <iostream> using namespace std; struct A { public: int a; }; class B : A {}; int main() { B item; item.a = 5; return 0; }
Standard input is empty
prog.cpp: In function ‘int main()’:
prog.cpp:12:7: error: ‘int A::a’ is inaccessible within this context
item.a = 5;
^
prog.cpp:6:6: note: declared here
int a;
^
Standard output is empty