模式意图:
Encapsulate a request as an object, thereby letting you parameterize clients with different request, queue or log requests, and support undoable operations.
模式点评:
Command模式的特点是回调(call-back)和支持撤销操作。事先在系统中注册好请求和响应者,以后可直接执行请求命令。Command模式常用在图形窗口系统中,在系统初始化时先注册好很多命令请求及响应者,如(OpenCommand, CApplication), (SaveCommand, CDocument), (HelpCommand, CWindow)。
模式结构: