Computer Science, asked by Dhananjay6613, 1 year ago

When is a friend function compulsory? give an example?

Answers

Answered by Anonymous
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 tanki1233
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