1.

How is it possible to have both const and non-const version of a function?(a) Function overriding(b) Function prototyping(c) Function overloading(d) Function declaringThis question was addressed to me by my school principal while I was bunking the class.This intriguing question comes from Constant Member Functions in portion Member Functions & its Types of Object Oriented Programming

Answer»

Correct answer is (c) Function overloading

The best I can EXPLAIN: The FUNCTIONS can be declared CONST and non-const in the same program. The TECHNIQUE USED is function overloading. We can define a const function and then a non-const version of same function using overloading.



Discussion

No Comment Found

Related InterviewSolutions