我希望在一条语句中声明多个 C++ 友元类,如下所示,只是为了整理代码。原因是,在我的实际应用中,会有三四个朋友类,所以它会比这个示例更混乱。
有可能以任何方式吗?
class A{
friend class B, C; // this doesn't work
// friend class B;
// friend class C; // these two would be okay
};
class B{};
class C{};
Run Code Online (Sandbox Code Playgroud)