fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. namespace my {
  5. class Block {
  6. private:
  7. int number;
  8. };
  9. }
  10.  
  11. int main() {
  12. my::Block block;
  13. block.number = 1;
  14.  
  15. return 0;
  16. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function 'int main()':
prog.cpp:7:8: error: 'int my::Block::number' is private
    int number;
        ^
prog.cpp:13:8: error: within this context
  block.number = 1;
        ^
stdout
Standard output is empty