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 |
Explain StretchBlt and BitBlt
What four types of properties are supported by an ActiveX control?
Will there be any difference in the image buffer size if it is loaded in from CString to LPTSTR using GetBuffer()? lptstr = string.GetBuffer(0);
what is the size of a process
1) How do you Destroy a Dialog Box ?
What are the advantages of using Doc/View or SDI over DialogBox
What is the base class for MFC Framework ?
what is the difference between SDI and MDI
15 Answers CMC, HCL, Siemens,
1)How to create ToolTip in MFC?
what is functioning of DIalodDataXchange ..?
Differ GetMessage, PostMessage & PeakMessage?
How do you change the properties for a tree view control that is part of the CTreeView class?