0

I am a beginner in c++. I come across to know about the mutable storage class and const functions in c++. Can any one explains with real life example where both things employ ? A real coding example would be much helpful.

Gaurav
  • 1
  • Or maybe http://stackoverflow.com/questions/105014/does-the-mutable-keyword-have-any-purpose-other-than-allowing-the-variable-to is better. – LogicStuff Jun 28 '16 at 06:49
  • Both of @LogicStuff duplicates are good but I think that the general idea is the following: A `const` method should never modify the **external** view of an object (you don't want successive call to `const` method to give different values), so use `mutable` only when you need to modify **internal** view in `const` method. – Holt Jun 28 '16 at 06:51
  • 1
    @Holt That is explained as *bitwise `const`* and *logical `const`* in the second link. – LogicStuff Jun 28 '16 at 06:56

0 Answers0