Chat-O-Matic/libs/libsupport/Singleton.h
2010-05-07 09:47:10 +00:00

25 lines
405 B
C++

/*
* Copyright 2010, Pier Luigi Fiorini. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _SINGLETON_H
#define _SINGLETON_H
template<typename T>
class Singleton {
public:
static T* Get()
{
if (!fInstance)
fInstance = new T();
return fInstance;
}
protected:
static T* fInstance;
Singleton() {}
};
#endif // _SINGLETON_H