I am using some objects of different classes inheriting from a base class in a method. Now I have the problem that when the object has a specific class in its inheritance structure I don't want the method to be executed.
A (pseudo)code example would look like this:
class A {};
class B : A {};
class C : A {};
class D : B {};
class E : C {};
void method(A* _object)
{
// If _object is of type C
// return;
// else do sth
}
I already checked this question but it doesn't help me because the name that is returned depends on the compiler if I understood one of the answers correctly.
EDIT: Because there were answers that I should rethink my program structure I realized that it is important to mention that I have no insight and no real chance to change the structure of the base classes because I am using a third-party library and the method I mentioned here is an virtual method from one of these base classes. So the accepted answer is good if you face a similiar problem but if you have a program that does not depend on third-party libraries it is better to rethink the structure and do sth like Petar Velev described in his answer.