friend ---- public and private
时间:2014-01-19 08:35:22
收藏:0
阅读:306
原文:http://www.cnblogs.com/hongjiumu/p/3525485.html
评论(0)
原文:http://www.cnblogs.com/hongjiumu/p/3525485.html
class A
{
public:
friend class B;
};
and
class A
{
private: //or nothing as the default is private
friend class B;
};
Is there a difference?
No, there‘s no difference - you just tell that class B is a friend of class A and now can access its private and protected members, that‘s all.