Figure 1 Getting the Class Name CBase::CBase()
{
// returns ptr to classCBase.
CRuntimeClass *prc = GetRuntimeClass();
}
So once again, the only way to get the derived class's runtime class from within the base class is to pass it.
class CBase : public CObject {
{
CBase(CRuntimeClass* pDerivedClass, ...);
•••
}
CDerived1::CDerived1(...) :
CBase(RUNTIME_CLASS(CDerived1),...)
{
•••
}
|