why we use friend function in c++ ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

why we use friend function in c++ ?

25th Sep 2016, 3:11 PM
pallavi
pallavi - avatar
3 Answers
+ 3
A friend function can access private members (fields and methods) of the class it is a friend of.
25th Sep 2016, 4:15 PM
Guy Mozes
Guy Mozes - avatar
0
cuz c++ is lonely
25th Sep 2016, 5:12 PM
hack69
0
friend function can use private members of the class that IT is friend of
27th Sep 2016, 2:36 PM
lujain