1.

Which among the following are valid ways of overloading the operators?(a) Only using friend function(b) Only using member function(c) Either member functions or friend functions can be used(d) Operators can’t be overloadedThe question was posed to me during an interview for a job.This interesting question is from Member Operator Function in division Member Functions & its Types of Object Oriented Programming

Answer»

Correct choice is (c) EITHER member functions or friend functions can be USED

Easy explanation - The OPERATORS can be OVERLOADED by using the member function or even the friend functions can be used. This is because both of these can access all the data members of a class.



Discussion

No Comment Found

Related InterviewSolutions