Explain Difference Between Operator Function as Member Function and as a Friend Function - Computer Science 1

Advertisements
Advertisements
Short Note

Explain difference between Operator Function as Member Function and as a Friend Function

Advertisements

Solution

The basic difference between operator function as a friend function and as member function is that a friend function will have only one argument for unary operators and only one for binary operators. This is because the object used to invoke the member function is passed implicitly and therefore is available for the member function. This is not the case with friend function. Arguments may be passed either by value or by reference.

Concept: C++ Programming
  Is there an error in this question or solution?
2015-2016 (March)
Share
Notifications



      Forgot password?
Use app×