• Welcome to Web Hosting Forum - A Web Hosting Community for Webmasters.
 

Recommended Providers

WordPress

Forum Membership

Forum Membership

What is a Private Constructor in programming?

Started by grofee, December 27, 2022, 12:41:06 PM


Hosting Offer


grofee


thmueller78

The main difference between public and private there is that other classes cannot create instances from the class with a private constructor.

Akshay_M

A private constructor is a special instance constructor. It is generally used in classes that contain static members only. If a class has one or more private constructors and no public constructors, other classes (except nested classes) cannot create instances of this class.

WordPress Hosting