/********************************************************************************
* File Name : Singleton.h
*
* EMail Addr : seakingw@163.com
*
*
* Description : interface for the CSingleton class.
*
********************************************************************************/
#ifndef _SINGLETONE_PATTERNS
#define _SINGLETONE_PATTERNS
* File Name : Singleton.h
*
* EMail Addr : seakingw@163.com
*
*
* Description : interface for the CSingleton class.
*
********************************************************************************/
#ifndef _SINGLETONE_PATTERNS
#define _SINGLETONE_PATTERNS
class CSingleton
{
public:
static CSingleton* Instance();
{
public:
static CSingleton* Instance();
protected:
CSingleton();
CSingleton();
private:
static CSingleton* _instance;
static CSingleton* _instance;
};
#endif
/********************************************************************************
* File Name : Singleton.cpp
*
* EMail Addr : seakingw@163.com
*
* Description : implementation of the CSingleton class.
*
********************************************************************************/
#include "Singleton.h"
* File Name : Singleton.cpp
*
* EMail Addr : seakingw@163.com
*
* Description : implementation of the CSingleton class.
*
********************************************************************************/
#include "Singleton.h"
CSingleton* CSingleton::_instance = 0;
CSingleton::CSingleton()
{
}
{
}
CSingleton* CSingleton::Instance()
{
if (_instance == NULL)
{
_instance = new CSingleton();
}
{
if (_instance == NULL)
{
_instance = new CSingleton();
}
return _instance;
}
}