C++ Builder 参考手册 ➙ System ➙ TObject ➙ InitInstance
头文件:#include <systobj.h>
命名空间:System
函数原型:
__classmethod __unsafe TObject *__fastcall InitInstance(void *Instance);
System::TObject::InitInstance 是 System::TObject 的成员函数,初始化成员,给他们清零。
- 这是 NewInstance 内部调用的函数,不要直接调用 InitInstance;
- 重载 NewInstance 的时候,在 NewInstance 的最后一句要调用 InitInstance;
- 不要重载 InitInstance,因为它不是 virtual 函数,初始化成员要写在构造函数里面。
参考:
- System::TObject::CleanupInstance
- System::TObject::NewInstance
- System::TObject::FreeInstance
- System::TObject::InstanceSize
- System::TObject
- VCL 类继承关系
C++ Builder 参考手册 ➙ System ➙ TObject ➙ InitInstance