// ConsoleTest.cpp : 定义控制台应用程序的入口点。
//
#include <iostream>
using namespace std;
class CSingleton
{
public:
static CSingleton* getInstance() //一个静态函数,获取累对象
{
if (NULL == m_pSingleton)
{
m_pSingleton = new CSingleton();
}
return m_pSingleton;
}
static void cleanInstance(){delete m_pSingleton;} //删除实例
int getValue(){return m_iValue;}
//
#include <iostream>
using namespace std;
class CSingleton
{
public:
static CSingleton* getInstance() //一个静态函数,获取累对象
{
if (NULL == m_pSingleton)
{
m_pSingleton = new CSingleton();
}
return m_pSingleton;
}
static void cleanInstance(){delete m_pSingleton;} //删除实例
int getValue(){return m_iValue;}