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?

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


Please Help Members By Posting Answers For Below Questions

What is a c++ vector?

987


Differentiate between C and C++.

1172


What c++ library is string in?

1000


Why do we need constructors in c++?

1059


How to declare an array of pointers to integer?

1069


How many types of comments are there in c++?

941


What is recursion?

1928


What is abstraction c++?

946


What are static and dynamic type checking?

1024


How the programmer of a class should decide whether to declare member function or a friend function?

1063


How many different levels of pointers are there?

1150


What is the use of register keyword with the variables?

894


What are exceptions c++?

990


Can I learn c++ without knowing c?

1001


What are the advantages of early binding?

1012