1.

If const version of a function when overloading is used, the function ___________________(a) Returns reference to object(b) Returns volatile reference(c) Returns mutable reference(d) Returns const referenceI had been asked this question by my college professor while I was bunking the class.I need to ask this question from Constant Member Functions in section Member Functions & its Types of Object Oriented Programming

Answer»

Correct option is (d) Returns const reference

The EXPLANATION is: The FUNCTION returns a const reference. This is to ensure that the value of object CALLING the function is not modified. This is a security feature.



Discussion

No Comment Found

Related InterviewSolutions