设计模式之命令模式(Command)
#include <iostream> #include <string> using namespace std; class Receiver { public: void do_execute() { cout << "I am the last receiver" <<endl; } }; class Command { public: void execute(){m_preceiver->do_execute();} private: Receiver *m_preceiver; }; int main() { Command *pcmd = new Command(); pcmd->execute(); return 0; }
一切源于对计算机的热爱