CObject::GetRuntimeClass
virtualCRuntimeClass*GetRuntimeClass()const;
Return Value
A pointer to the CRuntimeClass structure corresponding to this object’s class; never NULL.
Remarks
There is one CRuntimeClass structure for each CObject-derived class. The structure members are as follows:
LPCSTR m_lpszClassName A null-terminated string containing the ASCII class name.
int m_nObjectSize The size of the object, in bytes. If the object has data members that point to allocated memory, the size of that memory is not included.
UINT m_wSchema The schema number ( – 1 for nonserializable classes). See the IMPLEMENT_SERIAL macro for a description of schema number.
CObject* ( PASCAL* m_pfnCreateObject )( ) A function pointer to the default constructor that creates an object of your class (valid only if the class supports dynamic creation; otherwise, returns NULL).
CRuntimeClass* ( PASCAL* m_pfn_GetBaseClass )( ) If your application is dynamically linked to the AFXDLL version of MFC, a pointer to a function that returns the CRuntimeClass structure of the base class.
CRuntimeClass* m_pBaseClass If your application is statically linked to MFC, a pointer to the CRuntimeClass structure of the base class.
Feature Only in Professional and Enterprise Editions Static linking to MFC is supported only in Visual C++ Professional and Enterprise Editions. For more information, see .
This function requires use of the IMPLEMENT_DYNAMIC or IMPLEMENT_SERIAL macro in the class implementation. You will get incorrect results otherwise.
Example
See CObList::CObList for a listing of the CAge
class used in all CObject examples.
// example for CObject::GetRuntimeClass
CAge a(21);
CRuntimeClass* prt = a.GetRuntimeClass();
ASSERT( strcmp( prt->m_lpszClassName, "CAge" ) == 0 );
CObject Overview | Class Members | Hierarchy Chart
See Also CObject::IsKindOf, RUNTIME_CLASS