How do I check at runtime if an object is of type ClassA or of derived type ClassB? In one case I have to handle both instances separately
ClassA* SomeClass:
The syntax is this:
ClassA* SomeClass::doSomething ( ClassA* pa )
{
ClassB* pb = dynamic_cast(pa);
if( pb ) ...
(Note that this only works within polymorphic class hierarchies. That is, there have to be virtual functions involved.)
However, you should try to avoid that. What do you need it for that cannot be solved by applying virtual functions?