?? context.h
字號(hào):
//Context.h
#ifndef _CONTEXT_H_
#define _CONTEXT_H_
class Strategy;
/*這個(gè)類是Strategy模式的關(guān)鍵,也是Strategy模式和Template模式的根本
區(qū)別所在。 *Strategy通過“組合”(委托)方式實(shí)現(xiàn)算法(實(shí)現(xiàn))的異構(gòu),
而Template模式則采取的是繼承的方式 *這兩個(gè)模式的區(qū)別也是繼承和組合
兩種實(shí)現(xiàn)接口重用的方式的區(qū)別 */
class Context
{
public:
Context(Strategy* stg);
~Context();
void DoAction();
protected:
private:
Strategy* _stg;
};
#endif
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -