Answer Posted / roshanpr
mutable key word is used when u want to make any member
variable of a const object modifyable.
Basically when u make a object constant u cannot modify its
data members. But during the declaration of the class if a
data member is declared as mutable it can changed.
Class my
{
mutable int age;
public:
my(){age=0;}
void plusplus(int b)const
{
age+=b;
}
};
int main()
{
const my obj;
obj.plusplus(40);
}
Is This Answer Correct ? | 41 Yes | 7 No |
Post New Answer View All Answers
What is iomanip c++?
What is void pointer in c++ with example?
Is c++ vector a linked list?
What is a rooted hierarchy?
What is the default access level?
Can you sort a set c++?
What is auto type c++?
How do you clear a set in c++?
What is stream and its types in c++?
How would you call C functions from C++ and vice versa?
Who was the creator of c++?
Why should we use null or zero in a program?
Should I learn c++ c?
Define 'std'.
How does atoi function work?