What is "mutable" keyword?

Answer Posted / shakti singh khinchi

Mutable keyword is used to modify a data member of an object
which has declared as constant. for example:

class XYZ
{
public:
int i;
mutable int cc;
public:
XYZ();
};

int main()
{
const XYZ obj;
obj.cc = 100; // modify obj object's member "cc" which has
been declared as mutable.
}

Is This Answer Correct ?    16 Yes 7 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Does c++ support multilevel and multiple inheritances?

548


What is polymorphism in c++? Explain with an example?

607


What does int * mean in c++?

635


Write a program to add three numbers in C++ utilizing classes.

621


What is void pointer in c++ with example?

596






How do I exit turbo c++?

584


Define basic type of variable used for a different condition in C++?

664


Why do we need c++?

593


write a corrected statement so that the instruction will work properly. if (4 < x < 11) y = 2 * x;

1510


What is cin clear () in c++?

610


How do you write a function that can reverse a linked-list?

572


What is pointer to member?

600


Can we sort map in c++?

592


How do you declare A pointer to function which receives an int pointer and returns a float pointer

674


What is c++ iterator?

641