I know it's a beginner's doubt, but I need to heal that doubt. I searched the internet and sites do not always come into "agreement".
Does every class need to have a constructor?
Example:
I can make the student class and have no constructor and methods to register (name, age, rm) being this method responsible for providing the values for the properties of the class (name, age, rm) .
In my opinion, this is more practical when instantiating the class. If you just disable the student just calling desativar()
.
Because if the constructor gets the properties of the class every time it is to access some method it will have to pass all values (name, age, rm), even if only for desativar()
.
Am I thinking wrong? What is the best practice?