When is a friend function compulsory? give an example?
Answers
Answered by
6
n that case, the functions don't need to be declared as friends of the class, because they don't need access to private members. But these functions typically need to access at least one private member, so to gain that access, they need to be declared as friends of the class.
Answered by
13
In that case, the functions don't need to be declared as friends of the class, because they don't need access to private members. But these functions typically need to access at least one private member, so to gain that access, they need to be declared as friends of the class.
Similar questions