I l@ve RuBoard Previous Section Next Section

29.8 The mutable Qualifier

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 Previous Section Next Section