Can we have a private constructor ?

Answer Posted / aj

Yes, only if we want to prevent instantiation from other
class, but then the class itself cannot be sub classed.

this the heart of singleton design pattern

Is This Answer Correct ?    3 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is difference between multiple inheritance and multilevel inheritance?

875


What does <> mean pseudocode?

840


What is ambiguity in inheritance?

840


What is abstraction example?

828


What is multilevel inheritance explain with example?

865


What are oops functions?

779


What is the fundamental idea of oop?

856


Write A Program to find the ambiguities in Multiple Inheritance? How are they resolved.(Virtual Functions)

3819


Can we define a class within the interface?

787


What is the importance of oop?

830


What is object in oops?

821


What does sksksk mean in text slang?

1835


What do you mean by variable?

756


What is destructor example?

772


What is inheritance and how many types of inheritance?

812