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
Difference between overloaded functions and overridden functions
Can a Structure contain a Pointer to itself?
What is runtime polymorphism in c++?
What is c++ code?
What is command line arguments in C++? What are its uses? Where we have to use this?
List down the guideline that should be followed while using friend function.
How the memory management in vectors are being done. What happens when the heap memory is full, and how do you handle it ?
How do you invoke a base member function from a derived class in which you’ve overridden that function?
What is rtti in c++?
Which command properly allocates memory a) char *a=new char[20]; b) char a=new char[20]; c) char a=new char(20.0);
What is the auto keyword good for in c++?
What does obj stand for?
What is unary operator? List out the different operators involved in the unary operator.
Are strings immutable in c++?
What's the order in which the objects in an array are destructed?