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 command routing in MFC framework?

3 Answers  


What is document-view architecture ? Give me one real time example for SDI ?

2 Answers  


What is the difference between ASSERT and VERIFY?

2 Answers  


What interface must be supported by an ActiveX control?

2 Answers  


Explain about MDI and CMultiDocTemplate ?

2 Answers  






What is the base class for MFC Framework ?

4 Answers  


What is model and modeless dialog box ? Give some examples?

2 Answers   Mphasis,


Explain the flow of SDI application?

8 Answers   Mphasis,


If there is more than 100 control in a window how we can change the Taborder of a controls

4 Answers   Satyam,


What is the base class for MFC

3 Answers   HCL,


What is the use of CCmdTarget ?

4 Answers  


1)does Frame Thickness in MFC?

1 Answers   winfoware,


Categories