Friend declaration in C++ - difference between public and private

前端 未结 3 1999
花落未央
花落未央 2020-12-07 08:42

Is there a difference between declaring a friend function/class as private or public? I can\'t seem to find anything about this online.

I mean the difference between

3条回答
  •  Happy的楠姐
    2020-12-07 09:27

    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.

提交回复
热议问题