Export (0) Print
Expand All
MFC
TRY
Expand Minimize
1 out of 3 rated this helpful - Rate this topic

ASSERT_KINDOF 

This macro asserts that the object pointed to is an object of the specified class, or is an object of a class derived from the specified class.


ASSERT_KINDOF(classname, pobject )

Parameters

classname

The name of a CObject-derived class.

pobject

A pointer to a class object.

The pobject parameter should be a pointer to an object and can be const. The object pointed to and the class must support CObject run-time class information. As an example, to ensure that pDocument is a pointer to an object of the CMyDocument class, or any of its derivatives, you could code:

ASSERT_KINDOF(CMyDocument, pDocument)

Using the ASSERT_KINDOF macro is exactly the same as coding:

ASSERT(pobject->IsKindOf(RUNTIME_CLASS(classname)));

This function works only for classes declared with the DECLARE_DYNAMIC or DECLARE_SERIAL macro.

NoteNote

This function is available only in the Debug version of MFC.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.