A private constructor prevents the class from being instantiated outside of the class and is commonly used in ________.

  • Abstraction
  • Inheritance
  • Polymorphism
  • Singleton Pattern
A private constructor is commonly used in the Singleton design pattern. The Singleton pattern ensures that a class has only one instance, and the private constructor prevents external instantiation. It is not typically used for inheritance, polymorphism, or abstraction.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *