Can C++ have private constructor?

Typically, constructors have public accessibility so that code outside the class definition or inheritance hierarchy can create objects of the class. But you can also declare a constructor as protected or private .

Sizin İçin Seçtik  What is C++ constructor?

Leave a Reply

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