-
Notifications
You must be signed in to change notification settings - Fork 1
Singleton class
Bob edited this page Sep 7, 2017
·
2 revisions
The singleton class is the base class for any class that would only have one instance on your server. For example managers. Because of this the Singleton class has a slightly different new()
and destroy()
method.
Singleton is a sub class of the Object class
The new method creates a new instance of the class just like it would with the Object class however if an instance of the class already exists it will return that instance instead.
The destroy method simply destroys the instance of the class like it does with the object class. However it also allows for a new one to be created with the new
method instead of that returning the already existing one.