DELCARE_DYNAMIC(class) IMPLEMENT_DYNAMIC(class, classBase)
DELCARE_DYNAMIC(class) 主要用于声明CRunTimeClass结构,和获取CRunTimeClass指针,完成RTTI
#define DECLARE_DYNAMIC(className)\
public:\
static CRuntimeClass class##className;\
virtual CRuntimeClass *GetRuntimeClass() const;
DECLARE_DYNCREATE(class) IMPLEMENT_DYNCREATE(class, classBase)
DECLARE_DYNCREATE(class_name)包含DECLARE_DYNAMIC
#define DECLARE_DYNCREATE(class_name)\
DECLARE_DYNAMIC(class_name)\
static CObject* PASCAL CreateObject();
DECLARE_SERIAL(class_name) IMPLEMENT_SERIAL(class_name, classBase, wSchema)
包含
DECLARE_DYNCREATE(class_name)
抽象类中IMPLEMENT_SERIAL宏必须重定义
三个宏使得分别具有三个等级的性能:
1.基本机能以及对象诊断(可以使用afxDump输出诊断信息),以及Run Time Type Information(RTTI),IsKindOf()就是RTTI的化身;
2. 动态创建(Dynamic Creation)
3. 文件读写(Serialization)