33 lines
464 B
C++
33 lines
464 B
C++
|
/*
|
|||
|
* Singleton.cpp
|
|||
|
*
|
|||
|
* Created on: 4 нояб. 2021 г.
|
|||
|
* Author: alexander
|
|||
|
*/
|
|||
|
|
|||
|
#include "Singleton.hpp"
|
|||
|
|
|||
|
Singleton *Singleton::_instance = nullptr;
|
|||
|
|
|||
|
Singleton::Singleton() {}
|
|||
|
|
|||
|
Singleton* Singleton::Instance()
|
|||
|
{
|
|||
|
if (_instance)
|
|||
|
{
|
|||
|
_instance = new Singleton;
|
|||
|
}
|
|||
|
|
|||
|
return _instance;
|
|||
|
}
|
|||
|
|
|||
|
std::string Singleton::getDiscription()
|
|||
|
{
|
|||
|
return "I'm a statically initialized Singleton!";
|
|||
|
}
|
|||
|
|
|||
|
Singleton::~Singleton()
|
|||
|
{
|
|||
|
delete _instance;
|
|||
|
}
|