What is the benefit of using constructor?

One of the benefits of using a constructor over a method is that you can be assured the constructor was called and the work within the constructor was performed . The language specifies that to construct an object a constructor must be called.

Sizin İçin Seçtik  Why do we create instance of a class?

Leave a Reply

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