如何在C ++中实现这样的想法而不会陷入“无效使用不完整类型”的麻烦?
class A {
/*(...) some fields and methods here. */
class B {
/*(...) some fields and methods here. */
friend B A::fun();
};
B fun();
};
答案 0 :(得分:3)
这对我有用:
struct A {
class B;
B fun();
class B {
friend B A::fun();
};
};