1.

When the friend operator overloading is converted into member operator overloading _______________(a) Two parameters of friend function remains same parameters in member operator overloading(b) Two parameters of friend function becomes only one parameter of member function(c) Two parameters of friend function are removed while using member function(d) Two parameters of friend function are made 4 in member operator overloadingThe question was posed to me during a job interview.The origin of the question is Member Operator Function in portion Member Functions & its Types of Object Oriented Programming

Answer»

The correct choice is (b) Two parameters of friend function BECOMES only one PARAMETER of member function

To explain I would say: The friend function would accept two ARGUMENTS if some binary operator is overloaded. When we try to CONVERT that definition to member operator overloading then it becomes only one parameter. The reason behind is that the left operand is passed implicitly while using the member functions.



Discussion

No Comment Found

Related InterviewSolutions