1.

Which keyword must be used to declare a member function as a constant member function?(a) Constant(b) Const(c) FunctionConst(d) UnchangedThe question was posed to me during an interview for a job.My enquiry is from Constant Member Functions topic in division Member Functions & its Types of Object Oriented Programming

Answer»

The correct option is (B) Const

To explain: The keyword const is PROVIDED in most of the programming languages. This indicates that the member on which it is specified remains constant with the respective VALUES of members. The keyword MUST be mentioned so as to declare a member FUNCTION to be constant.



Discussion

No Comment Found

Related InterviewSolutions