IMPLEMENT_DYNCREATE

IMPLEMENT_DYNCREATE

This   macro   must   appear   in   the   implementation   file   for   any   class   that   uses   DECLARE_OLECREATE.   
    
The   external   name   is   the   identifier   exposed   to   other   applications.   Client   applications   use   the   external   name   to   request   an   object   of   this   class   from   an   automation   server.   
    
The   OLE   class   ID   is   a   unique   128-bit   identifier   for   the   object.   It   consists   of   one   long,   two   WORDs,   and   eight   BYTEs,   as   represented   by   l,   w1,   w2,   and   b1   through   b8   in   the   syntax   description.   ClassWizard   and   AppWizard   create   unique   OLE   class   IDs   for   you   as   required.  

Parameters

class_name

派生类名.

base_class_name

基类名.

Remarks

框架使用这种技巧动态的创建新的对象。如,序列化时,从盘中读一个对象。在类实现的文件中添加宏IMPLEMENT_DYNCREATE. For more information, see .

如果你使用了DECLARE_DYNCREATE 和 IMPLEMENT_DYNCREATE 宏, 你可以使用RUNTIME_CLASS 宏和 CObject::IsKindOf 成员函数去决定是否在运行时中创建宏.

如果类声明的文件中包含有DECLARE_DYNCREATE, 类实现的文件中必须有 IMPLEMENT_DYNCREATE.

Example

/* CAge.h */

class CAge : public CObject

{

     int num;

public:

     DECLARE_DYNCREATE(CAge)

};

//==============

/* CAge.cpp */

#include "stdafx.h"

#include "CAge.h"

IMPLEMENT_DYNCREATE(CAge, CObject)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值