Inside a const member function of a class, which data members can be modified?
Correct answer A. Only members declared mutable
In a const member function, this points to a const object, so ordinary non-static data members are read-only. Members declared mutable are an exception and may be modified, which suits caches, lazy computations or mutex members that do not affect the object's logical state. Static data members are not part of the object, so const does not restrict them.
Answer checked How we write and check questions
Discussion