What is the purpose of friend function, I know it has access to the private section. But what is it the difference between it and using a class member function?
Printable View
What is the purpose of friend function, I know it has access to the private section. But what is it the difference between it and using a class member function?
Your friends can touch your privates! :p
That's what I said, but what its point since I can just use a class member function ?
Hey Such, on that article he posted, scroll down till you see:
[14.5] Should my class declare a member function or a friend function?
Is that what you are looking for?
Dave_Sinkula's link has more information on your question.
In short, you cannot always use a class member function, as is the case with operator<<. Also, classes can be friends, and you cannot nest a class inside more than one other class.
Yeah thats it, I did not even knew that it was a link.
Thanks