Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок0
What is the difference between Friend Functions and Friend classes? How could they be useful or used?
Real life analogy helpful
3 ответов
+ 4
you are a good player for challenger. !
+ 2
If you declare a function as friend, then that function can access class's private members. On the other hand, if you declare class B as a friend class of the class A then every method of class B is a friend function to class A and can access its private members.
Most common uses are quick fixes in long programs or overloading binary operators,etc.
0
Thank you 😁