Mutable storage class specifier

0

mutable is the one of the storage specifier in C++. In general, const function does not allow to modify data members of an object who called it. However, with the help of mutable specifier, we can achieve it.Simple example shows use of mutable specifier. #include using namespace std;class base { unsigned int m_int; mutable unsigned int m_mutableInt;public: base(unsigned int x, unsigned int y) { m_int = x; m_mutableInt = y; } void read() const { //const function m_int = 40; /...

Read this post on allabouttechnologies.co.in


Karan Arora

blogs from Chandigarh

Recommended for you