$ cat foo.cpp #include class foo { private: mutable int dawut; public: foo() : dawut(42) { } void showme() const { printf("foo.dawut = %d\n", dawut); } void bar() const { dawut = 23; } }; int main() { const foo foo; foo.showme(); foo.bar(); foo.showme(); return 0; } $ gcc -std=c++11 -O2 -Wall foo.cpp -o foo $ ./foo foo.dawut = 42 foo.dawut = 23