Function for all possible derived classes

I have an interface class Base and some derived classes. I want to write a "cloning" function
 
Base* foo(Base*);

which will make a copy of an object of some derived class (it is possible that this class is unknown for me // or it can be interpreted as: I have access only to Base class implementation) to dynamic memory and return a pointer to copy.

I think it's not very difficult to write foo function if I have full list of derived classes but I can't understand how to write foo function for all possible derived classes of Base class. Please help me.
Topic archived. No new replies allowed.