Original Post
Hi. I've got a question, I'm sure it's pretty basic, but I'd like to know what the options are. I have a (STL) list of class instances, all of them of different classes, but all derived from a particular base class. There's a virtual function in the base class implemented by the derived classes. I want to just pick an object in the list and call this function, but I'm under the impression that unless I re-cast it to the right (derived) type (which I don't know!), the base virtual function will be called instead of the derived one? Is that right or not, and if it is, what are the alternatives? (BTW, when copying one of these lists or manipulating them, the original derived classes will be maintained right? It won't do something stupid like copying one of the instances as if it was of the base class, even though the list is defined as a list of instances of the base class?)