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 do you mean by volatile and mutable keywords used in c++?
What are the various storage classes in C++?
Explain some examples of operator overloading?
What is object in c++ wikipedia?
What is the importance of mutable keyword?
What is meaning of in c++?
Can char be a number c++?
. If employee B is the boss of A and C is the boss of B and D is the boss of C and E is the boss of D. Then write a program using the Database such that if an employee name is Asked to Display it also display his bosses with his name. For eg. If C is displayed it should also display D and E with C?
What is the purpose of ios::basefield in the following statement?
Which ide is best for c++?
Explain rethrowing exceptions with an example?
What is lvalue?
Can recursive program be written in C++?
What is general form of pure virtual function? Explain?
What is vectorial capacity?