22 lines
345 B
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!";
|
||
|
}
|
||
|
}
|