"DaTurk" <mm******@hotmail.comwrote in message
news:11**********************@c77g2000hse.googlegr oups.com...
Hi, I want to check the type of a derived unmanaged class, upcasted to
it's base class in CLI. Basically, I have several c++ classes that
derive from a single abstract base class. I'm passing the base class
in, and I want to check the type, and cast it later. Please advise.
If you want to print out the name of the actual runtime dynamic type for
debugging purposes:
object->GetType()->Name
If you want to run some code depending on what type it is, use a virtual
function in the base class. If you absolutely can't change the base class,
use dynamic_cast<DerivedType^>(object), it will be a DerivedType^ or nullptr
depending on whether the object is really a DerivedType (or derived from
it).