yau*_*ser 3 c++ forward-declaration incomplete-type
我怎样才能在 C++ 中实现这样的想法而不陷入“无效使用不完整类型”的麻烦?
class A {
/*(...) some fields and methods here. */
class B {
/*(...) some fields and methods here. */
friend B A::fun();
};
B fun();
};
Run Code Online (Sandbox Code Playgroud)
这对我有用:
struct A {
class B;
B fun();
class B {
friend B A::fun();
};
};
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
818 次 |
| 最近记录: |