Comparing polymorphic types
I have created an abstract type (call it base), and several inherited types (child1..n). I then created an array of base classes.
I have used this array to store instances of each of the child classes. This all works fine, but I would like to be able to see which one of the child classes is stored in each element of the array. I have tried using the typeid() function, but that comes up with a warning that it can't be used with polymorphic types!
I could always just add another atribute to the base class that says which one of the child classes it was using, but I am reluctant to do this, purley becasue it seems like a bit of a cop-out! I have also tried messing around with pointers (array of pointers to base class) without any luck! Any ideas?