23
loading...
This website collects cookies to deliver better user experience
Create()
method, which first checks if the singleton object exists. If it doesn't, it allocates a new one and returns that. Else, it just returns the singleton that you already created.Create()
function at once, which otherwise would've caused undefined behavior.Create()
methods also don't take parameters.Create()
method that takes parameters that decide which factory item subclass to return. Some classes abstract the object initialization logic to a public static Get()
method and make the static Create method protected. The base classes for factories and factory items are always abstract, meaning that subclassing is required.23