adspace
Answer Posted / Alok Kumar Agmani
The 'mutable' storage class specifier is used to allow a member variable of a const object to be modified within non-const member functions. This is useful when we have a const object that contains data that can change, such as variables related to counting or timing. For example:n```nstruct counter {n int m_count;n mutable unsigned long m_last_accessed;n void increment() {n ++m_count;n m_last_accessed = std::time(nullptr);n }n};
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers