Free help with homework

Why join Brainly?

  • ask questions about your assignment
  • get answers with explanations
  • find similar questions

What happens when constructor is defined in private section.. need the answer very urgentlyy!! tomorrow is my exam.. help me peepz!!




This Is a Certified Answer

Certified answers contain reliable, trustworthy information vouched for by a hand-picked team of experts. Brainly has millions of high quality answers, all of them carefully moderated by our most trusted community members, but certified answers are the finest of the finest.
   The private and public functionality and inheritance of them probably depends on the OOPS language and environment.  Different languages may have different implementations.

   When a method or data is designated as private, it not accessible from outside that class.  But the method can be called implicitly by the other methods in the same class.  There is a special purpose why it is done.

   We cannot instantiate this object from other classes as constructor cannot be called.  It is used in a class with all static members ie., a static class.  This is accessible from any where and no instantiation is needed or, is to be done.

  This is done in cases of singleton object instance. Only one instance is created and is accessible from any where.  Perhaps it contains global data and methods.

  Also, a class  is prevented from being extended or inherited. so no sub classes.

  This is used in case of constants only class for preventing instantiation.
  Also when factory supplied multiple constructor methods are available with names (which are more readable names), we have the constructor private.  The appropriate constructor is called explicitly.

  Also, it is possible that a public constructor is used during instantiation and that method uses the private constructor in the same class to perform certain tasks.
1 5 1
click on thanks button above pls;;select best answer
The Brain
  • The Brain
  • Helper
Not sure about the answer?
Learn more with Brainly!
Having trouble with your homework?
Get free help!
  • 80% of questions are answered in under 10 minutes
  • Answers come with explanations, so that you can learn
  • Answer quality is ensured by our experts