What are const member functions?

What are const member functions?
A. Functions in which none of the data members can be changed in a program
B. Functions in which only static members can be changed
C. Functions which treat all the data members as constant and doesn’t allow changes
D. Functions which can change only the static members
 
Answer: c
Explanation: The const member functions are intended to keep the value of all the data members of a class same and doesn’t allow any changes on them. The data members are treated as constant data and any modification inside the const function is restricted.
 

Tìm kiếm

Back
Top