fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. class foo
  5. {
  6. private int m_var;
  7. void setVar(int a_var)
  8. {
  9. // do something before setting value, like emitting signal
  10. m_var = a_var;
  11. }
  12. void method()
  13. {
  14. int copy = m_var; // ok
  15. m_var = 5; // error!
  16. setVar(101); // ok
  17. }
  18. };
  19.  
  20. int main() {
  21. // your code goes here
  22. return 0;
  23. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:6:13: error: expected ':' before 'int'
     private int m_var;
             ^
stdout
Standard output is empty