✎
编程开发网
首页
C语言
C++
面试
Linux
函数
Windows
数据库
下载
搜索
当前位置:
首页
->
AI编程基础
->
c++编程基础
Design Patterns---- Strategy 模式(二)
2014-11-24 10:52:35
·
作者:
·
浏览:
1
标签:
Design
Patterns----
Strategy
模式
shContext(){ if(pCashSuper_) delete pCashSuper_; } double GetResult(double money){ assert(pCashSuper_ != NULL); return pCashSuper_->acceptCash(money); } private: CashSuper *pCashSuper_; // copy not allowed CashContext(const CashContext&); CashContext& operator=(const CashContext&); }; // 客户端使用如下: CashContext csuper("满300减100"); cout << csuper.GetResult(300) << endl;
参考资料:
1.
大话设计模式
2. 设计模式:可复用面向对象软件的基础
首页
上一页
1
2
下一页
尾页
2
/2/2