fork download
  1.  
  2. class A {
  3. void foo();
  4.  
  5. friend class C;
  6. };
  7.  
  8. class B : private A {
  9. };
  10.  
  11. class C {
  12. void bar() { B b; b.foo(); }
  13. };
  14.  
  15. int main() {
  16. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In member function ‘void C::bar()’:
prog.cpp:3: error: ‘void A::foo()’ is private
prog.cpp:12: error: within this context
prog.cpp:12: error: ‘A’ is not an accessible base of ‘B’
stdout

Standard output is empty