1.

Which operator among the following can be overloading using only member function?(a) Assignment operator(b) Addition operator(c) Subtraction operator(d) Multiplication and division operatorI got this question in unit test.This intriguing question comes from Member Operator Function topic in division Member Functions & its Types of Object Oriented Programming

Answer»

The correct answer is (a) Assignment operator

Explanation: Only the assignment operator AMONG the options given must be overloaded using the member functions. The assignment operator can’t be overloaded using friend FUNCTION. This is a restriction in the programming languages to make the PROGRAMS more resistant TOWARDS errors.



Discussion

No Comment Found

Related InterviewSolutions