Why constructor is used instead of methods?

The most important difference: When you instantiate an object it’s constructor will be invoked whereas calling a method is always optional . You therefore might forget to call your initialization method and fail to initialize everything correctly.17 Mar 2012

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

Leave a Reply

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