मराठी
महाराष्ट्र राज्य शिक्षण मंडळएचएससी विज्ञान (संगणक विज्ञान) इयत्ता १२ वी

Explain the difference between operator function as member function and as a friend function. - Computer Science 1

Advertisements
Advertisements

प्रश्न

Explain the difference between operator function as member function and as a friend function.

फरक स्पष्ट करा
स्पष्ट करा
Advertisements

उत्तर

The main difference between an operator function implemented as a friend function and as a member function is that a friend function requires one argument for unary operators and two arguments for binary operators. In a member function, the object that calls the function is passed implicitly, so it is automatically available to the function. This implicit passing does not occur in the case of a friend function. The arguments can be passed either by value or by reference.

shaalaa.com
  या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
2016-2017 (March)

APPEARS IN

2015-2016 (March) (with solutions)
Q 2.2.1. (iii) | 2 marks
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×