Article ID: 192099
Article Last Modified on 11/18/2003
STATIC_DOWNCAST( class_name, pobject )Parameters:
class_nameThe name of the class you want to cast to.
pobjectThe pointer to be cast to a pointer to a class_name object.
This macro casts pobject to a pointer to a class_name object. pobject
must either be NULL, or point to an object of a class which is derived
directly, or indirectly, from class_name. In builds of your application
with the _DEBUG preprocessor symbol defined, the macro will ASSERT if
pobject is not NULL and if it points to an object that is not a "kind
of" the class_name (see definition for the CObject::IsKindOf). In non-
_DEBUG builds, the macro performs the cast without any type checking.
class_name must be derived from CObject and use the DECLARE_DYNAMIC and
IMPLEMENT_DYNAMIC, the DECLARE_DYNCREATE and IMPLEMENT_DYNCREATE, or the
DECLARE_SERIAL and IMPLEMENT_SERIAL macros explained in the Help topic
"CObject Class: Deriving a Class from Cobject."
For example, you might cast a pointer to CYourDocument, called pYourDoc,
to a pointer to CDocument using the following expression:
CDocument* pDoc = STATIC_DOWNCAST(CDocument, pYourDoc);
If pYourDoc does not point to an object derived directly or indirectly
from CDocument, the macro will ASSERT.
151070 FIX: DYNAMIC_DOWNCAST & STATIC_DOWNCAST Causes Stack Overflow
Additional query words: DECLARE_DYNAMIC IMPLEMENT_DYNAMIC DECLARE_DYNCREATE IMPLEMENT_DYNCREATE DECLARE_SERIAL IMPLEMENT_SERIAL IsKindOf
Keywords: kberrmsg kbbug kbfix kblangcpp kbvc600fix kbdocs kbdocerr KB192099