1 // 'mutable' keyword 2 // BZ_MUTABLE 3 4 class num { 5 6 public: num(int z)7 num(int z) 8 { 9 x_ = z; 10 numReads_ = 0; 11 } 12 set(int z)13 void set(int z) 14 { x_ = z; } 15 get() const16 int get() const 17 { 18 ++numReads_; 19 return x_; 20 } 21 22 private: 23 int x_; 24 mutable int numReads_; 25 }; 26 main()27int main() 28 { 29 num q(4); 30 q.set(5); 31 int k = q.get(); 32 q.get(); 33 return 0; 34 } 35 36