What does friend function means? How to use it? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What does friend function means? How to use it?

found this topic in C++

15th Nov 2017, 10:09 AM
Jwala Anirudh
Jwala Anirudh - avatar
2 Answers
+ 13
C++ Friend Functions. A friend function of a class is defined outside that class' scope but it has the right to access all private and protected members of the class. Even though the prototypes for friend functions appear in the class definition, friends are not member functions. Source - https://www.tutorialspoint.com/cplusplus/cpp_friend_functions.htm
15th Nov 2017, 10:14 AM
qwerty
qwerty - avatar
+ 2
You can also read about it in C++ Tutorial → More on Classes → The Friend Keyword
15th Nov 2017, 10:46 AM
Ipang