相关代码 |
|
#ifndef _COMMAND_H_ #define _COMMAND_H_ class Command { public: virtual void Execute() = 0; }; template class SpecificCommand : public Command { protected: typedef void (CommandList::* Action)(); Action action; CommandList *commandlist; public: SpecificCommand(CommandList* c, Action a) { commandlist = c; action = a; } void Execute() { (commandlist->*action)(); } }; #endif