Quantcast
Channel: C++ friend functions/class uses? - Stack Overflow
Browsing all 4 articles
Browse latest View live

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 Article



Answer 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 Article

Answer 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 Article

C++ 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
Browsing all 4 articles
Browse latest View live




Latest Images