摘要: class Component{public: virtual void Operation() = 0;};class ConcreteComponent : public Component{public: // Interface. virtual void Operation() override { cout Operation(); AddedBehavior(); }private: // logic. void AddedBehavior() { cout <<"ConcreteDecorator::AddedBehavior(... 阅读全文
posted @ 2013-01-24 17:53 walfud 阅读(136) 评论(0) 推荐(0) 编辑
摘要: class A{public: // Interface. void foo() { cout foo(); m_b->bar(); m_c->baz(); }};int main(int argc, char *argv[]){ Facade f(new A, new B, new C); f.qux(); // TODO: Release memory. return 0;} 阅读全文
posted @ 2013-01-24 15:59 walfud 阅读(143) 评论(0) 推荐(0) 编辑