M
Michael
Hi All,
Is there a function similar to Java's instanceof in C++?
To ask the question a different way, if I have a base class and two derived
classes, how can I tell which one of the derived classes a particular object
belongs to?
BaseClass* base;
if(some_test){
base = new Class1;
} else {
base = new Class2;
}
How can I tell if I created a Class1 or Class2 object from the object?
Thanks for your help
Michael
Is there a function similar to Java's instanceof in C++?
To ask the question a different way, if I have a base class and two derived
classes, how can I tell which one of the derived classes a particular object
belongs to?
BaseClass* base;
if(some_test){
base = new Class1;
} else {
base = new Class2;
}
How can I tell if I created a Class1 or Class2 object from the object?
Thanks for your help
Michael