Can we have a private constructor ?
Answers were Sorted based on User's Feedback
Answer / namrata ahuja
no. constructors are always declared publicly. they are used
to initialize data members of a class. they are
automatically invoked by a class object declaration so if it
is private it cannot be invoked.
| Is This Answer Correct ? | 6 Yes | 39 No |
Answer / ravi`
no,
we can not make a constructor private , if we make a
constructor private its method cannot access in main method .
| Is This Answer Correct ? | 17 Yes | 136 No |
How to overload new operator in c++
What is friend function?
what is virtual function?
What is abstraction and encapsulation?
Write a program to accept a number and to print numbers in pyramid format? for eg:for a no. 5 1 212 32123 4321234 543212345
What is the real time example of inheritance?
when to use 'mutable' keyword and when to use 'const cast' in c++
What is data binding?
What is the default size allocated for array in the statement if size not specified " int a[] "
What is the purpose of enum?
What is an orthogonal base class?
Why is abstraction needed?