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 |
What is primitive and non-primitive application?
How WM_PAINT message gets called in MFC,please explain it . a)Who calls the WM_PAINT message? b)When it gets called? c)how it comes to message queue? Please Explain it
What is the difference between the Encapsulation and Abstraction
25 Answers HCL, Invensys, TCS, Wipro,
What is a message map?
How to handle RTTI in MFC ?
How do you change the properties for a tree view control that is part of the CTreeView class?
If there is more than 100 control in a window how we can change the Taborder of a controls
What is socket?
What function is used to disable a control at runtime?
1) create ToolTip in MFC?
What is #progma and where it is used?
What is Multithreading