How to handle RTTI in MFC ?



How to handle RTTI in MFC ?..

Answer / n.venkateshwara rao.

RTTI (Run Time Type Identification) in MFC can be handled
by using the class CRunTimeClass.

But CRunTimeClass can be use to identify the type of the
class which are derived from CObject.

For eg -

void MyFunction()
{
CObject *mObject = new MyClass;
if(mObject->IsKindOf(RUNTIME_CLASS( MyClass) ) )
{
printf("Class is of type MyClass\n");
}
else
{
printf("Class is of type someotherclass\n");
}
}

We can use "type_info" for other type of classes which are
not derived from CObject.

Is This Answer Correct ?    15 Yes 1 No

Post New Answer

More MFC Interview Questions

What is the difference between ASSERT and VERIFY?

2 Answers  


Does the application have more than one object? If Yes, Briefly explain.

2 Answers   Soltius Infotech,


How many types of combo box are their

2 Answers   Aaditya Info Solutions, E Logic,


i have created runtime menu -- ( admistrator ->managepackage,manage module). but now i want to open a dialog when i select manage package and any other diaolg when selecting manage module ( whole selection is at run time only ) . Please HELP .its urgently required

3 Answers   Patni,


how does conditionally close the Dialog Box ?

2 Answers   Infotech,






1)How to change a text of a button as Dynamically?

1 Answers   HCL,


How to update windows title bar dynamically?

7 Answers   HCL,


how do u identify RTTI in vc++

4 Answers   Siemens,


1)How to create ToolTip in MFC?

2 Answers  


Does the application have more than one object? If no, then what is the reason?

5 Answers  


what is the use of CCmdTarget?

4 Answers   Siemens,


How do I create a dialog box in mfc?

0 Answers  


Categories