Friend Functions

Hey guys,
I hope all of you C++ geeks are doing well. i was reading friend function and there is a black are for me now.
look at the code below:

1
2
3
4
5
6
7
8
class friend1
{
public:
friend class friend2;
.
.
.
};


so now friend2 has access to private data members of friend1, but does friend1 also has access to private data members of friend2? or statement "friend class friend1" also should be stated in class friend2 declaration?

regards
> but does friend1 also has access to private data members of friend2?

No. Members of friend1 have no special access rights to friend2.

Unless friend2 declares that friend1 is a friend.
Topic archived. No new replies allowed.