+ 1
Why a constructor is always declare as the public? But not as private or protected.
3 Answers
+ 3
There are some design patterns that use access restriction on constructors like Singleton and Abstract Factory.
+ 2
You can declare the private constructor. But you can't create the object of class because the constructor cannot be called outside the class.
And the compiler will not allow you to create a protected constructor
0
becoz constructor is called when the object is declared ,object is declared outside the class ,outside the class we can only access the public member function of the class ...