Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


What is "mutable" keyword?

Answers were Sorted based on User's Feedback



What is "mutable" keyword?..

Answer / 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

What is "mutable" keyword?..

Answer / 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

More C++ General Interview Questions

why we cant create array of refrences

4 Answers  


Explain all the C++ concepts using examples.

0 Answers   InterGraph,


What is the full form of ios?

0 Answers  


Types of storage and scope of each type

2 Answers   CA,


Can we declare a base-class destructor as virtual?

0 Answers  


Can a new be used in place of old mallocq? If yes, why?

0 Answers  


Write a single instruction that will find the remainder of integral division when x is divided by y. Have the answer stored in z.

1 Answers  


How do you save a c++ program?

0 Answers  


Explain the difference between c++ and java.

0 Answers  


Write a program to reverse a linked list?

8 Answers   Catalytic Software, Satyam,


Can constructor be private in c++?

0 Answers  


How much maximum can you allocate in a single call to malloc()?

0 Answers  


Categories