Is it mandatory to use constructor in a class?

Users do not need to write constructors for every class. A constructor can be declared using any of the access modifiers. It is mandatory to have a constructor with the right access modifier . However, the compiler supplies a default if an access modifier is not defined in the class and a constructor is not declared.

Sizin İçin Seçtik  How many times destructor is called?

Leave a Reply

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

Is it mandatory to use constructor in a class?

Users do not need to write constructors for every class. A constructor can be declared using any of the access modifiers. It is mandatory to have a constructor with the right access modifier . However, the compiler supplies a default if an access modifier is not defined in the class and a constructor is not declared.

Sizin İçin Seçtik  Biyoteknoloji Bölümü mezunları ne iş yapar?

Leave a Reply

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