STATIC_DOWNCAST( class_name, pobject )
Parameters
class_name
The name of a class.
pobject
A pointer to be cast to a pointer to a object of type class_name.
Remarks
In builds of your application with the _DEBUG preprocessor symbol defined, this macro will cast a pointer to an object from one class to a pointer of a related type. The macro will ASSERT if the pointer is not NULL and points to an object that is not a "kind of" the target type.
In non-_DEBUG builds, the macro performs the cast without any checking.
The target type is specified by the class_name parameter, while the pobject parameter identifies the pointer. You might, for example, cast a pointer to CYourDocument
called pYourDoc
to a pointer to CDocument using this expression:
CDocument* pDoc = STATIC_DOWNCAST(CDocument, pYourDoc);
If pYourDoc
does not point to a CDocument object, the macro will ASSERT.
See Also DYNAMIC_DOWNCAST