In the context of Singleton pattern, which one of the following statements is true?
c)
a Factory class generates the desired type of objects on demand.
hence, it might be required that only one Factory object exists; in this case, Singleton can be employed in a Factory class.
a) a Singleton class needs to have a static member to return a singleton instance
b) a Singleton class must declare its constructor(s) private to ensure that they are not instantiated
d) a static method (typically named getInstance()
) with public access may need to be provided to get the instance of the Singleton class.