有时候类不需要重复新建(new),只需要新建一个实例,用的时候拿过来直接使用
class xx { public; static xx *getInstance(); } /**************** 单例模式 ***************/ xx *xx::getInstance() { if(NULL == instance) { instance = new xx(); } return instance; }