首页 > 其他 > 详细

friend ---- public and private

时间:2014-01-19 08:35:22      阅读:306      评论:0      收藏:0      [点我收藏+]
I mean the difference between:

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.

friend ---- public and private

原文:http://www.cnblogs.com/hongjiumu/p/3525485.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!