is constructor always public?
In singleton design pattern , we have constructor as private
If you want to create object of given class- yes. But sometimes when you do not want to create object, you may make it private. (I wrote a code in which class has private ctor) https://code.sololearn.com/cub4oA2riU4b/?ref=app
@Vignesh can you give source of such an implementation of Singleton? Everyone and every site I've been learning from told me that ctor in singleton is private.
sorry @jakub stasiak typo error it is Private.. link : http://www.yolinux.com/TUTORIALS/C++Singleton.html if you want to prevent your object from being copied you have to declare the constructor as private.