c++学习
cocos_Wei
代码伤我千百遍 我爱代码如初恋
展开
-
c++ 访问者模式
写个基类 #ifndef Employee_hpp #define Employee_hpp #define CC_SYNTHESIZE(varType, varName, funName)\ protected: varType varName;\ public: virtual varType get##funName(void) const { return varName原创 2016-03-08 16:31:14 · 429 阅读 · 0 评论 -
c++ 观察者模式
#ifndef Observer_hpp #define Observer_hpp #define CC_SYNTHESIZE(varType, varName, funName)\ protected: varType varName;\ public: virtual varType get##funName(void) const { return varName; }\ public:原创 2016-03-08 16:39:26 · 553 阅读 · 0 评论 -
c++ 组合模式
#ifndef Staff_hpp #define Staff_hpp #define CC_SYNTHESIZE(varType, varName, funName)\ protected: varType varName;\ public: virtual varType get##funName(void) const { return varName; }\ public: virtua原创 2016-03-08 16:42:27 · 386 阅读 · 0 评论 -
c++ 工厂模式
#ifndef Animal_hpp #define Animal_hpp #define CC_SYNTHESIZE(varType, varName, funName)\ protected: varType varName ;\ public: virtual varType get##funName(void) const { return varName; }\ public: vir原创 2016-03-09 18:48:13 · 427 阅读 · 0 评论 -
宏定义的好用方法
//设置set跟get的方法#define CC_SYNTHESIZE(varType, varName, funName)\ protected: varType varName ;\ public: virtual varType get##funName(void) const { return varName; }\ public: virtual void set##funName(va原创 2016-03-09 18:50:54 · 402 阅读 · 0 评论 -
c++ 抽象工厂与工厂混合写法
#ifndef Animal_hpp #define Animal_hpp #define CC_SYNTHESIZE(varType, varName, funName)\ protected: varType varName;\ public: virtual varType get##funName(void) const { return varName; }\ public: virt原创 2016-03-09 18:59:02 · 543 阅读 · 0 评论 -
c++ 单例模式
#ifndef CCriticalSection_hpp #define CCriticalSection_hpp #include #include class CCriticalSection { private: pthread_mutex_t mutex; public: CCriticalSection(); ~CCriticalSection(); pub原创 2016-03-10 14:32:52 · 457 阅读 · 0 评论 -
c++ 桥接模式
#ifndef Product_hpp #define Product_hpp #include #include using namespace std; class Product { public: Product() {}; ~Product() {}; virtual void info(); }; #endif /* Product_hpp */ #i原创 2016-03-10 15:50:36 · 444 阅读 · 0 评论