摘要: #include #include #include using namespace std;stack g_stack;class Context{public: void SetExpression(string sExpr) { m_sExpr = sExpr; } string ... 阅读全文
posted @ 2014-12-23 09:57 stanley19861028 阅读(304) 评论(0) 推荐(0) 编辑
摘要: #include using namespace std;template class Iterator{public: T& Value() { return *m_pValue; } Iterator& operator=(const Iterator& other) { ... 阅读全文
posted @ 2014-12-22 14:12 stanley19861028 阅读(115) 评论(0) 推荐(0) 编辑
摘要: #include #include using namespace std;class Memento{public: Memento(string sState) { m_sState = sState; } string GetState() { return m_sStat... 阅读全文
posted @ 2014-12-19 12:20 stanley19861028 阅读(136) 评论(0) 推荐(0) 编辑
摘要: #include using namespace std;class ObjectA{public: void Whoami() { coutWhoami(); m_pObjectB->Whoami(); } void Interact2() { m_pObjectB->Whoami()... 阅读全文
posted @ 2014-12-19 09:29 stanley19861028 阅读(138) 评论(0) 推荐(0) 编辑
摘要: #include #include using namespace std;#define DESTROY_POINTER(ptr) if (ptr) { delete ptr; ptr = NULL; }class Element;class Visitor{public: virtual ... 阅读全文
posted @ 2014-12-18 16:54 stanley19861028 阅读(147) 评论(0) 推荐(0) 编辑
摘要: #include using namespace std;#define DESTROY_POINTER(ptr) if (ptr) { delete ptr; ptr = NULL; }class Receiver{public: void Action1() { coutAction1()... 阅读全文
posted @ 2014-12-17 12:02 stanley19861028 阅读(122) 评论(0) 推荐(0) 编辑
摘要: #include using namespace std;class Chain{public: bool Handle() { return false; }};class Level1 : public Chain{public: bool Handle() { ... 阅读全文
posted @ 2014-12-16 16:42 stanley19861028 阅读(95) 评论(0) 推荐(0) 编辑
摘要: #include using namespace std;#define DESTROY_POINTER(ptr) if (ptr) { delete ptr; ptr = NULL; }class Context;class DbState{public: DbState(Context* ... 阅读全文
posted @ 2014-12-16 12:03 stanley19861028 阅读(155) 评论(0) 推荐(0) 编辑
摘要: #include #include using namespace std;#define DESTROY_POINTER(ptr) if (ptr) { delete ptr; ptr = NULL; }class Observer{public: virtual void Update(s... 阅读全文
posted @ 2014-12-15 11:52 stanley19861028 阅读(166) 评论(0) 推荐(0) 编辑
摘要: #include using namespace std;#define DESTROY_POINTER(ptr) if (ptr) { delete ptr; ptr = NULL; }class TemplateMethod{public: void AlgorithmA() { Step... 阅读全文
posted @ 2014-12-15 09:55 stanley19861028 阅读(169) 评论(0) 推荐(0) 编辑