C++ Builder 参考手册 ➙ System ➙ TInterfacedObject
System::TInterfacedObject 是 VCL/FMX 里面需要 IInterface 接口的一些类的公共父类。
- System::TInterfacedObject 简介
- System::TInterfacedObject 成员
一. System::TInterfacedObject 简介
System::TInterfacedObject 是 VCL/FMX 里面需要 IInterface 接口的一些类的公共父类。
- 继承关系:
System::TObject
⠀╙ System::TInterfacedObject - 头文件:
#include <systobj.h> - 命名空间:
System - System::TInterfacedObject 是支持 IInterface 接口的线程安全的基类
- System::TInterfacedObject 提供了基本的引用计数功能
二. System::TInterfacedObject 成员
1. System::TInterfacedObject 属性
| 属性 | 类型 | 说明 |
|---|---|---|
| public: | ||
| RefCount | int | 引用计数 |
2. System::TInterfacedObject 方法
| 成员函数 | 说明 |
|---|---|
| public: | |
| _AddRef | 增加引用计数 |
| AfterConstruction | 在构造函数执行结束时调用 |
| BeforeDestruction | 在析构函数执行之前时调用 |
| NewInstance | 给实例分配内存,并且返回新的实例的地址 |
| operator _di_IInterface | 类型转换操作符,转为 _di_IInterface 类型 |
| QueryInterface | 返回当前组件所支持的 COM 接口的引用 |
| _Release | 减少引用计数 / 销毁对象 |
| TInterfacedObject | 构造函数 |
| ~TInterfacedObject | 析构函数 |
| TObject:: | 从 System::TObject 继承过来的 |
| public: | 从 System::TObject 继承过来的 |
| ClassInfo | 返回运行时类型信息表 (RTTI table) |
| ClassName | 获取类名,不包含命名空间的类名字符串 |
| ClassNameIs | 判断类名是否为参数指定的字符串 |
| ClassParent | 返回父类的类型信息 |
| ClassType | 返回类的类型信息 |
| CleanupInstance | 清除长字符串、Variants、接口变量等 |
| DefaultHandler | 默认的消息处理 |
| Dispatch | 处理消息的函数 |
| DisposeOf | 强制销毁对象 |
| Equals | 比较当前对象和 Obj 对象是否相同 |
| FieldAddress | 通过成员名称返回成员的地址 |
| Free | 销毁对象 (Delphi) |
| FreeInstance | 释放 NewInstance 分配的内存 |
| GetHashCode | 返回对象的 hash 值 |
| GetInterface | 获取指定的接口 |
| GetInterfaceEntry | 获取接口项目 |
| GetInterfaceTable | 获取接口表 |
| InheritsFrom | 当前对象的类是否从 AClass 继承过来的 |
| InitInstance | 初始化成员,给他们清零 |
| InstanceSize | 返回给实例数据分配内存需要多少字节数 |
| MethodAddress | 通过名称返方法的地址 |
| MethodName | 通过方法的地址返回名称 |
| QualifiedClassName | 返回包含命名空间的类名 |
| SafeCallException | 处理异常的函数 |
| ToString | 转为字符串 |
| UnitName | 返回类所在的命名空间 |
| UnitScope | 返回类所在的命名空间 |
3. System::TInterfacedObject 数据成员
| 数据 | 类型 | 说明 |
|---|---|---|
| protected: | ||
| FRefCount | int | 用于保存引用计数 |
参考:
- System::IInterface
- System::_di_IInterface
- System::TCppInterfacedObject
- System::Classes::TComponent
- System::Classes::TInterfacedPersistent
- System::Classes::TPersistent
- System::Syncobjs::TSynchroObject
- System::TObject
- VCL 类继承关系
C++ Builder 参考手册 ➙ System ➙ TInterfacedObject
