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
क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
