在包含该类列表的结构后定义的C 类
C++ class defined after a struct that contains a list of that class
我有一个父级虚拟类(及其孩子,但这不是问题)
//---------------------------------------------------------------------
class TPowerComponent
{
public :
int X, Y, Rotation;
__fastcall TPowerComponent( PowSymbType AType );
__fastcall TPowerComponent( TStream& S );
virtual void __fastcall Store( TStream& S );
__fastcall ~TPowerComponent();
virtual void __fastcall Paint(TCanvas * Canvas, const WorkSheetInfoRec& WSInfo); // se dessine
};
其方法之一(油漆)使用工作表inforec结构,该结构在上面定义:
struct WorkSheetInfoRec {
int WSOpt, Study;
std::list<TPowerComponent*> NetWorkList;
};
问题在于,该结构使用的objectz列表是父母的,该类别具有一种方法(paint),该方法也指的是使用列表的结构...因此,汇编失败了,因为必须在另一个之前声明每个汇编。我该如何在标题文件中处理。
谢谢
使用前向声明:
class TPowerComponent;
struct WorkSheetInfoRec {
int WSOpt, Study;
std::list<TPowerComponent*> NetWorkList;
};
相关文章:
- 在类构造函数中定义结构变量的参数
- C++ 通过函数传递自定义结构
- 在C++中循环访问自定义结构列表的小问题
- 如何在Qt中使用QDataStream将自定义结构保存/加载到二进制文件中?
- 如何在C++中的.h文件中的类中定义结构
- 如何定义C结构:C-linkage和udt
- 结构向量中自定义结构函数的内存使用
- 类型转换自定义结构
- 使用结构绑定更改自定义结构的值
- 信号槽自定义结构问题
- 如何将unordered_set与自定义结构一起使用?
- 定义结构中没有默认构造函数的类
- 为什么C++在自定义结构向量时会出现 ostream 重载问题?
- 通过自定义结构和链接列表类中的C 中的哈希表
- 从自定义结构数组中提取数据
- 无法使用自定义结构的属性
- 通过引用将自定义结构的向量传递给 boost::compute 闭包或函数
- 如何从输入中定义的"external" int 定义结构中的数组大小
- 定义结构数组
- 在Cython中定义C 结构返回类型