In C++, const qualifier can be applied to
1) Member functions of a class
2) Function arguments
3) To a class data member which is declared as static
4) Reference variables
(A) Only 1, 2 and 3
(B) Only 1, 2 and 4
(D) Only 1, 3 and 4
Explanation: When a function is declared as const, it cannot modify data members of its class.
When we don’t want to modify an argument and pass it as reference or pointer, we use const qualifier so that the argument is not accidentally modified in function.
Class data members can be declared as both const and static for class wide constants.
Reference variables can be const when they refer a const location.
Quiz of this Question