fork download
  1. struct thing {
  2. int member;
  3.  
  4. void myfunction() const {
  5. int thing1 = 65;
  6. thing1 = 3;
  7. member = -1; //error: assignment of data-member ‘thing::member’ in read-only structure
  8. }
  9. };
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In member function ‘void thing::myfunction() const’:
prog.cpp:7: error: assignment of data-member ‘thing::member’ in read-only structure
stdout
Standard output is empty