klips/cpp/patterns/singleton/singleton.cpp

16 lines
313 B
C++
Raw Normal View History

2021-05-11 16:21:03 +00:00
#include "singleton.hpp"
Singleton::~Singleton()
{
// Delete any allocated data, close any opened files, etc..
}
Singleton &Singleton::getInstance()
{
// Construct a new singleton if it doesnt exist, return it
// + If a static Singleton exists already, just return it
static Singleton l;
return l;
}