What is a mutable member?

Answer Posted / nimish singh

One that can be modified by the class even when the object of the class or the member function doing the modification is const.

Understanding this requirement implies an understanding of C++ const, which many programmers do not have. I have seen large class designs that do not employ the const qualifier anywhere. Some of those designs are my own early C++ efforts. One author suggests that some programmers find const to be such a bother that it is easier to ignore const than to try to use it meaningfully. No wonder many programmers don't understand the power and implications of const. Someone who claims to have enough interest in the language and its evolution to keep pace with the ANSI deliberations should not be ignorant of const, however.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain unexpected() function?

830


total amount of milk produced each morning and then calculates and outputs the number of cartons needed for this milk , the cost of producing the milk and the profit from producing this milk.

2323


Write about the local class and mention its use?

838


What is the difference between ++ count and count ++?

849


How a modifier is similar to mutator?

898


What is the difference between the functions rand(), random(), srand() and randomize()?

967


How does work in c++?

844


What is ifstream c++?

818


What is the extraction operator and what does it do?

840


What does flush do c++?

823


You want to link a c++ program to c functions. How would you do it?

747


What is difference between class and structure in c++?

889


What are the uses of pointers?

807


Define copy constructor.

868


Explain how an exception handler is defined and invoked in a Program.

882