Singleton的实现:
- class Singleton
- {
- public:
- static Singleton* getInstance();
- protected:
- Singleton(){};
- ~Singleton(){};
- private:
- static Singleton* Instance;
- };
- Singleton* Singleton::Instance = 0;
- Singleton* Singleton::getInstance()
- {
- if(Instance == 0) //position 1
- Instance = new Singleton();
- return Instance;
- }
-----------------------------------------------------------
树的前中后递归遍历
void PreTraverse(BinNode* root, void (*fn)(const BinNode*))
etc.
-----------------------------------------------------------