Friend function: Difference between revisions

Content deleted Content added
No edit summary
No edit summary
Line 3:
</ref>
 
A friend function is declared by the class that is granting access, so friend functions are part of the class interface, like methods. Friend functions allow alternative syntax to use objects, for instance <code>f(x)</code> instead of <code>x.f()</code>, or <code>g(x,y)</code> instead of <code>x.g(y)</code>. Friend functions have the same implications on [[separation of concerns|encapsulation]] as methods.
 
A similar concept is that of [[friend class]].