Specify a class member function as a friend of another class?

后端 未结 7 790
小蘑菇
小蘑菇 2020-12-08 21:43

According to the C++ Primer book, the author mentioned that We can specify a class member function as a friend of another class, instead of the entire class (page 634).

7条回答
  •  天命终不由人
    2020-12-08 22:23

    firstly forward declare class A, so that its visible in class B definition. then define class A containing a friend function from class B.

提交回复
热议问题