Monday, May 22, 2006

IMPLEMENT_DYNAMIC / DECLARE_DYNAMIC

IMPLEMENT_DYNAMIC and DECLARE_DYNAMIC are macros provided by Visual Studio for adding runtime type checking support to your CObject derived class.

See this article on MSDN for an overview on adding run-time class information and other features to your CObject derived class.

DECLARE_DYNAMIC declares the appropriate methods, and thus should be used in your class definition:
class CPerson : public CObject
{
DECLARE_DYNAMIC( CPerson )

// rest of class declaration follows...
};


IMPLEMENT_DYNAMIC implements the methodes, and thus should be used outside of your class definition:
IMPLEMENT_DYNAMIC( CPerson, CObject )


IMPLEMENT_DYNCREATE enables objects of CObject-derived classes to be created dynamically at run time when used with the DECLARE_DYNCREATE macro.

0 Comments:

Post a Comment

<< Home