DECLARE_DYNAMIC Macro

Syntax

DECLARE_DYNAMIC( className );

Parameters

className

The name of the class that you want to be compliant with the ability of class CObject to supply dynamic run-time class information.

Remarks

Any class derived from class CObject can supply run-time information about itself and its base class, provided you invoke the DECLARE_DYNAMIC and IMPLEMENT_DYNAMIC macros. This means you can determine the exact class of an object at run time and also determine the base class from which it was derived.

Put the DECLARE_DYNAMIC macro in your class declaration. Put the IMPLEMENT_DYNAMIC macro in your .CPP file. These macros add code to your class to enable dynamic run-time information.

You can access the dynamic information about a class with the IsKindOf member function of class CObject and with the RUNTIME_CLASS macro. This run-time information is available and valid only for classes that have a single base class. For more information and examples, see the Class Libraries User's Guide, Chapter 8, “The CObject Class.”

See Also

IMPLEMENT_DYNAMIC, RUNTIME_CLASS, CObject