1.

Functions which differ in const-ness are considered ______________________(a) To have same signature(b) To have different signature(c) To produce compile time error(d) To produce runtime errorI have been asked this question during an interview.This intriguing question comes from Constant Member Functions in portion Member Functions & its Types of Object Oriented Programming

Answer»

Correct answer is (B) To have different signature

The best I can explain: The FUNCTIONS are CONSIDERED to have different signature. This is because the const-ness also defines the type of function or the working of functions. And HENCE the functions can be considered different. This is the reason that we can use function overloading for const and non-const version of same function.



Discussion

No Comment Found

Related InterviewSolutions