A class "Doctor" should be created in such a way that out side class members are not allowed to create the instance of a Doctor class where as the members of Doctors class is allowed , Which of the following option is suitable for this requirement ?
Create an instance constructor with private access modifier.
Create a static constructor.
Create Doctor class as static class.
Create Doctor class as sealed class.
When the Doctor class having private constructor then outside class members are not allowed to call the same. But Doctor class members can create object by calling private constructor.
Back To Top