Singleton in Action?

Neia Neutuladh neia at ikeran.org
Sat Feb 2 20:30:15 UTC 2019


On Sat, 02 Feb 2019 17:34:11 +0000, Eugene Wissner wrote:
> For creation get() should be always used, since it is the most
> convenient way to ensure that there is really only one instance of the
> singleton. Just make this() private, so only you can create new
> instances:
> 
> private this()
> {
> }

And consider putting the class in its own source file.


More information about the Digitalmars-d-learn mailing list