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 sorting algorithm does c++ use?
What is the use of pointer in c++ with example?
What's the most powerful programming language?
How do you flush a buffer in c++?
What are arithmetic operators?
Can member functions be private?
Can c++ be faster than c?
What is the standard template library (stl)?
Is string data type in c++?
What is a flag in c++?
Eplain extern keyword?
How do I make turbo c++ full screen?
What are the two types of polymorphism?
What is a storage class used in c++?
What is the exit function in c++?