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
Can I learn c++ without c?
What causes a runtime error c++?
Why is the function main() special?
What are containers in c++?
Can you help me with this one? Make a program that when a user inputed a Product Name, it will display its price, and when the user inputed the quantity of the inputed product, it will show its total price. The output must be like this: Product Name: Price: Quantity: Total Price: ..this is the list of products to be inputed: Cellphone - 1500 Washing Machine - 5200 Television - 6000 Refrigirator - 8000 Oven - 2000 Computer - 11000 thanks..:D
What does scope resolution operator do?
Explain what data encapsulation is in c++?
What is operators in c++?
What is a dll entry point?
Write about an iterator class?
How does java differ from c and c++?
Explain the use of this pointer?
What is the C-style character string?
What do you mean by function pointer?
what are Access specifiers in C++ class? What are the types?