chinaunix网友2010-03-18 10:31:03
#include
using namespace std;
class Temp {
public:
static Temp * getInstance();
static void putInstance();
private:
Temp() { cout << "constructor" << endl; }
~Temp() { cout << "destructor" << endl; }
static Temp *instance;
};
Temp * Temp::getInstance()
{
cout << "getInstance" << endl;
if (!instance)
instance = new Temp();
r