This repository has been archived on 2022-11-20. You can view files and clone it, but cannot push or open issues or pull requests.
patterns/singleton/singleton.d

22 lines
345 B
D

module singleton.singleton;
class Singleton
{
private static Singleton singleton;
private this() {}
static Singleton getInstance()
{
if (singleton is null)
singleton = new Singleton;
return singleton;
}
string getDescription()
{
return "I'm a classic Singleton!";
}
}