呵呵...原来api兄弟也看见了...我想野比兄是笔误了
学习需要安静。。海盗要重新来过。。
#include<iostream> using namesapce std; class SingleObj{ public: static SingleObj* GetSingleObj(); void dump() const{ cout<<"this is singleobj.."<<endl; } private: SingleObj(){} static SingleObj obj; }; SingleObj SingleObj::obj; SingleObj* SingleObj::GetSingleObj() { return &obj; } int main(void) { SingleObj::GetSingleObj()->dump(); SingleObj obj_(*SingleObj::GetSingleObj()); obj_.dump(); return 0; }