0 votes
in C Plus Plus by

What is a friend class?

1 Answer

0 votes
by

Friend classes are used when we need to override the rule for private and protected access specifiers so that two classes can work closely with each other.

Hence, we can have a friend class to be a friend of another class. This way, friend classes can keep private, inaccessible things in the way they are.

When we have a requirement to access the internal implementation of a class (private member) without exposing the details by making the public, we go for friend functions.

Related questions

0 votes
asked Jun 18, 2020 in C Plus Plus by Robindeniel
0 votes
asked Jun 11, 2020 in C Plus Plus by Robindeniel
...