I have a base class which has several derived classes. Within the derived class I have an enum which tells me which derived class the object belongs to. Now, I want a function create a new object of a derived class, and the only parameter I'd pass would be the enum value of the class I want to create.

I can easily make a function which does a case/switch on the enum and does the appropriate new, but I was wondering if there is a better/more elegant/different way of doing it...?