Google News
logo
CPP - Quiz(MCQ)
What is the importance of mutable keyword in C++?
A)
It will copy the values of the variable
B)
It allows the data member to change within a const member function
C)
It allows the data member to change outside a const member function
D)
It will not allow the data member to change within a const member function

Correct Answer :   It allows the data member to change within a const member function


Explanation :

The mutable keyword allows the data member of a class to change within a const member function.
 
It allows to assign the values to a data member belonging to a class defined as “Const” or constant.
 
It allows a const pointer to change members.
 
It can be only applied to non-static and non-const data members of a class.

Advertisement