adspace


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

Can union be self referenced?

1279


What character terminates all character array strings a) b) . c) END

1403


What is the latest version on c++?

1217


daily Routine of father

1492


How c functions prevents rework and therefore saves the programers time as wel as length of the code ?

1172