I've not used C++ in a while, and I've become far too comfortable with the ease-of-use of real languages.
At any rate, I'm attempting to implement the Command pattern, and I need to map a number of command object implementations to string keys. I have an STL map of string to Command, and I'd like to copy the Command.
Essentially,
Command * copiedCommand = new Command( commandImplementation );
And I'd like to retain the functionality of commandImplementation. Since Command has the pure virtual function execute
, this doesn't work. What's the correct way to do this?