This repository has been archived on 2022-11-09. You can view files and clone it, but cannot push or open issues or pull requests.
patterns-old/lesson_5/Singleton.cpp

33 lines
464 B
C++
Raw Normal View History

2021-11-03 22:35:16 +00:00
/*
* 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;
}