Why constructor is used in a class?

We use constructors to initialize the object with the default or initial state . The default values for primitives may not be what are you looking for. Another reason to use constructor is that it informs about dependencies.

Sizin İçin Seçtik  Mine Uzun CNN Türk'ten ayrıldı mı?

Leave a Reply

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

Why constructor is used in a class?

We use constructors to initialize the object with the default or initial state . The default values for primitives may not be what are you looking for. Another reason to use constructor is that it informs about dependencies.

Sizin İçin Seçtik  What is the function difference between function and method?

Leave a Reply

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