CObject::IsKindOf

Syntax

BOOL IsKindOf( const CRuntimeClass* pClass ) const;

Parameters

pClass

A pointer to a CRuntimeClass structure associated with your CObject-derived class.

Remarks

IsKindOf tests this object to see if (1) it is an object of the specified class or (2) if it is an object of a class derived from the specified class. This function only works for classes declared with the DECLARE_DYNAMIC or DECLARE_SERIAL macros.

Do not use this function extensively because it defeats the C++ polymorphism feature. Use virtual functions instead.

Return Value

TRUE if the object corresponds to the class; otherwise FALSE.

Example

CAge a(21); // must use IMPLEMENT_DYNAMIC or IMPLEMENT_SERIAL

ASSERT( a.IsKindOf( RUNTIME_CLASS( CAge ) ) );

See Also

CObject::GetRuntimeClass, RUNTIME_CLASS