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
What is a sequence in c++?
What is functions syntax in c++?
Explain friend class?
What do you mean by public protected and private in c++?
What are the various access specifiers in c++?
Write a single instruction that will store an EVEN random integer between 54 and 212 inclusive in the variable myran. (NOTE only generate EVEN random numbers)
What is a local reference?
Can we define a constructor as virtual in c++?
What does 7/9*9 equal ? a) 1 b) 0.08642 c) 0
What is the purpose of the "delete" operator?
What is the purpose of ios::basefield in the following statement?
Should the member functions which are made public in the base class be hidden?
How do you master coding?
On throwing an exception by the animal constructor in p = new animalq, can memory leak occur?
If there are two catch statements, one for base and one for derived, which should come first?