fork download
  1. #include <iostream>
  2.  
  3. class A
  4. {
  5. static void Method() { std::cout << "method called."; }
  6. };
  7.  
  8. class B : public A
  9. {
  10. // Has a bunch of stuff but not "Method"
  11. };
  12.  
  13. int main()
  14. {
  15. B::Method();
  16. }
Compilation error #stdin compilation error #stdout 0s 3296KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:5:16: error: ‘static void A::Method()’ is private
    static void Method() { std::cout << "method called."; }
                ^
prog.cpp:15:14: error: within this context
    B::Method();
              ^
stdout
Standard output is empty