29.8 The mutable Qualifier

I l @ ve RuBoard

Normally you can't modify the members of a constant object. If a member is declared mutable, it can be modified. For example:

 class sample {     public:        int i1;        mutable float f1; // ... }; const sample a_sample; a_sample.i1 = 1;    // Illegal, attempt to modify a constant a_sample.f1 = 1.0;  // Legal. f1 is mutable. 
I l @ ve RuBoard


Practical C++ Programming
Practical C Programming, 3rd Edition
ISBN: 1565923065
EAN: 2147483647
Year: 2003
Pages: 364

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net