fork download
  1. #include <iostream>
  2.  
  3. struct A { virtual void f() { std::cout << __PRETTY_FUNCTION__ << '\n'; } };
  4. struct B : protected A { void f() override { std::cout << __PRETTY_FUNCTION__ << '\n'; } };
  5.  
  6. int main()
  7. {
  8. B b;
  9. A* p = &b;
  10.  
  11. b.f();
  12. p->f();
  13. p->A::f();
  14. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:9:13: error: ‘A’ is an inaccessible base of ‘B’
     A* p = &b;
             ^
stdout
Standard output is empty