answersLogoWhite

0

mutable keyword can only be applied to non-static and non-constant member of a class. It indicates that the corresponding data member can be modified even from the constant function. (Constant function: is a function marked with the keyword const)

For eg.

class x {

private:

mutable int query_count;

int value;

public:

int get_value() const

{

query_count++;

return value;

}

};

In the code above member query_count is marked with keyword mutable. Hence it's value can be modified from constant function get_value().

User Avatar

Wiki User

15y ago

What else can I help you with?