1.

What are the constant member functions?(a) Functions which doesn’t change value of calling object(b) Functions which doesn’t change value of any object inside definition(c) Functions which doesn’t allow modification of any object of class(d) Functions which doesn’t allow modification of argument objectsThe question was posed to me in an online quiz.Question is from Constant Member Functions in portion Member Functions & its Types of Object Oriented Programming

Answer»

The correct OPTION is (a) Functions which doesn’t change VALUE of calling OBJECT

Easy explanation - The constant member functions are a special type of member functions. These are intended to restrict any modification in to the values of object which is USED to invoke that function. This is done to ENSURE that there are no accidental modifications to the object.



Discussion

No Comment Found

Related InterviewSolutions