#ifndef _SINGLETON_H_
#define _SINGLETON_H_
#include <stdio.h> template<typename T>
class CSingleton
{
private:
CSingleton(){} //构造函数是私有的
public:
static T * GetInstance()
{
static T instance; //局部静态变量
return &instance;
}
}; #endif
#ifndef _SINGLETON_H_
#define _SINGLETON_H_
#include <stdio.h> template<typename T>
class CSingleton
{
private:
CSingleton(){} //构造函数是私有的
public:
static T * GetInstance()
{
static T instance; //局部静态变量
return &instance;
}
}; #endif