friend ---- public and private

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

上一篇:linux终端下文件不同颜色的含义


下一篇:linux信号量