Private Constructors can't be access from any derived classes neither from another class

Options
- True
- False


CORRECT ANSWER : True

Discussion Board
Private Constructor

Private constructors doesn't allow the class from being called or instantiated explicitly called by some other class/function. The private constructor can be useful in the following cases:

1. classes containing only static utility methods
2. classes containing only constants
3. type safe enumerations
4. singletons

Private constructors object can't be created by any caller calling the class. Only static items can be used for this class. If the constructor is not defined in the class then by default it is public no-argument constructor. So, that it can't be accessed from any other class.

Rohit Sharma 08-14-2014 07:22 PM

Write your comments


Enter the code shown above:

(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)


Advertisement