Explain mutable storage class specifier.
Answer / 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 |
What is a class template in c++?
Copy Linked List using recursive function?
How do you clear a buffer in c++?
Explain terminate() function?
What is the function of I/O library in C++ ?
Explain public, protected, private in c++?
1.what is the difference between software & package &application.
What is a node class?
Explain how a pointer to function can be declared in C++?
What are the techniques you use for debugging?
structure that describe a hotel with name, address,rooms and number of rooms
Why c++ is so important?