What is the Singleton design pattern used for?

  • To define a one-to-many dependency between objects so that changes to one object result in changes to many other objects.
  • To enforce a single instance of a class per application.
  • To ensure that a class has only one instance and provide a global point of access to that instance.
  • To provide a way to dynamically instantiate objects of a specified class.
The Singleton design pattern is used to ensure that a class has only one instance and to provide a global point of access to that instance. This can be useful in situations where it is important to have a single instance of a class that provides a shared resource.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *