Difference between friend class and friend member function? | Sololearn: Learn to code for FREE!

+2

Difference between friend class and friend member function?

I want to know how the friend class works?. because Even friend member functions can be used to access both regular and the private variables across classes. Then what is a friend class?? can anyone tell me please?

5/20/2018 8:25:32 AM

Sneha Johnson

1 Answer

New Answer

+10

Friend function is a function that is able to access the private and protected members of a class. In contrast, a friend class is a classwhich help in accessing the privatemembers of a class. A friend functionis declared by including its prototype inside the class, antecede it with thekeyword friend. https://techdifferences.com/difference-between-friend-function-and-friend-class.html