Exam 1z0-809 All QuestionsBrowse all questions from this exam
Question 234

You want to create a singleton class by using the Singleton design pattern.

Which two statements enforce the singleton nature of the design?

    Correct Answer: A, B

    To enforce the singleton nature of a class, you should first make the constructor private. This prevents other classes from instantiating the singleton class directly. Second, you need to override the static reference to point to the single instance, ensuring that there is only one instance of the class throughout the application.

Discussion
M_JawadOptions: AC

B. Make the constructor private. D. Use a static reference to point to the single instance.

steefaandOptions: BC

B and C are correct.

iSnoverOptions: BD

The answer is BD: B. Make the constructor private. D. Use a static reference to point to the single instance.

jduarteOptions: BC

Answer B and C.