What is constructor why it is called so?

It is called constructor because it constructs the values of date members of the class . A constructor can never return any value. Hence, it is written with no return type (even void is not written). e.g. A constructor is declared and defined as follows. //class with constructor.

Sizin İçin Seçtik  What are constructors and methods?

Leave a Reply

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