Create a class with only one instance

xiaoxiao2021-03-30  202

class Single_Instance {public: Single_Instance * Get_Instance (); private: Single_Instance * pCur_Instance; int data; Single_Instance (); Single_Instance (Single_Instance & copy); ~ Single_Instance ();}; Single_Instance :: Single_Instance () {cout << "new SINGLE! "<< Endl;} SINGLE_INSTANCE :: SINGLE_INSTANCE :: SINGLE_INSTANCE (SINGLE_INSTANCE & COPY) {cout <<" new single by copy! "<< Endl;} single_instance :: ~ Single_instance () {cout <<" destroy single! <

转载请注明原文地址:https://www.9cbs.com/read-130622.html

New Post(0)