Is it always necessary to provide a default constructor for a class Why or why not?

If a class is not required to initialize its data member or does not contain data member, there is no need to write empty constructor explicitly . On class object creation, default constructor implicitly called will be enough. In below class, default constructor will be called on object creation of the class.

Sizin İçin Seçtik  Can I learn both ML and web development?

Leave a Reply

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