You create Microsoft Windows-based applications.
You are designing a class to be used by multiple client applications. This class will be used to generate unique account numbers. Your company guidelines state that unique number generating components must comply with the following design pattern:
Classes must be designed so that they cannot be instantiated directly by client applications. Only a single instance of the class must be used by all the client applications. Instance methods and properties for these classes must be accessible to client applications.
You need to define how this class will implement the design pattern. Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)
A.
Declare the class constructors as private.
B.
Declare the class constructors as internal.
C.
Create a public static method to retrieve an existing instance of the class, or a new instance if one does not exist.
D.
Create a public instance method to retrieve an existing instance of the class, or a new instance if one does not exist.
E.
Create a private static method to retrieve an existing instance of the class, or a new instance if one does not exist.