1.

Which objects can call the const functions?(a) Only const objects(b) Only non-const objects(c) Both const and non-const objects(d) Neither const not non-const objectsThis question was posed to me in examination.The origin of the question is Constant Member Functions topic in portion Member Functions & its Types of Object Oriented Programming

Answer»

Correct choice is (C) Both const and NON-const objects

For EXPLANATION: All the objects of a class can CALL const functions for its use. Const objects can call the const functions to SINCE those values are already constant. And the non- const objects can call the const functions to keep their values constant.



Discussion

No Comment Found

Related InterviewSolutions