
设计模式
leagalhigh
never give up!
展开
-
单例
来自九章算法: C++的代码: class Solution { public: static Solution * instance; Solution(){} static Solution* getInstance(); }; Solution* Solution::getInstance(){ if (NULL == instance) {转载 2016-11-28 23:02:22 · 210 阅读 · 0 评论 -
形状工厂-lintcode
C++代码: /** * Your object will be instantiated and called as such: * ShapeFactory* sf = new ShapeFactory(); * Shape* shape = sf->getShape(shapeType); * shape->draw(); */ class Shape { public:原创 2016-11-29 12:51:57 · 272 阅读 · 0 评论