Image

Imageoracular_rufio wrote in Imagecpp

Is there a way to determine if an object is an instance of a particular derived class?

I have a list of objects that are all instances of different classes that inherit the same base class. All of these derived classes have member functions which are not in the base class, but which do more or less the same thing. I'd like to call the relevant function for each object, but I don't have a way of determining which objects are instances of which derived class. Restructuring the inheritance hierarchy is not an option here, because these are all Qt classes. Is there something in C++ that will allow me to test the objects to see if they are instances of certain classes? I vaguely recall something called "ofclass," but I don't remember if that was C++ or something else, and I haven't worked with inheritance in a long time.