fork(2) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. class c1
  5. {
  6. public:
  7. class c2
  8. {
  9. protected:
  10. static int func(int i);
  11. };
  12.  
  13. public:
  14. int a1;
  15. private:
  16. int a2;
  17. };
  18.  
  19. int c1::c2::func(int i)
  20. {
  21. c1::a2= 1;
  22. printf("func");
  23. return 0;
  24. }
  25.  
  26. int main() {
  27.  
  28. //c1::c2::func(0);
  29. return 0;
  30. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In static member function ‘static int c1::c2::func(int)’:
prog.cpp:16:7: error: invalid use of member ‘c1::a2’ in static member function
   int a2;
       ^
prog.cpp:21:6: error: from this location
  c1::a2= 1;
      ^
stdout
Standard output is empty