↧
Answer by Yola for C++ friend functions/class uses?
i think often friend function usage its a matter of readability. For example next overloaded operator looks symmetrically and this may be good for code reader.friend const X operator+(const X&,...
View ArticleAnswer by juliomalegria for C++ friend functions/class uses?
Using friend is actually very discouraged in C++ (it kinda breaks the whole encapsulation idea), but it comes to my mind an example where only friend is the right approach:friend ostream &...
View ArticleAnswer by Charlie Martin for C++ friend functions/class uses?
"In C++, only your friends can access your private parts."The point of a friend is that you can package your software into smaller groupings, like friend classes etc, while still allowing access to the...
View ArticleC++ friend functions/class uses?
What is the real use of a friend function/class in C++? Could you give an example where only friend is the right approach?Thanks
View Article