I'm working with Angular.
I'm wondering about whether constructors are needed, and would appreciate some insight. In several classes, I have constructor that are empty most of the time my service classes have empty constructors.
Can these empty constructors be removed? Are there any negative impact to a class have no constructor vs having an empty one?
If you don't use DI (dependency injection) service for Angular in your class you can remove it .
If the class won't be used by third parties and you don't need an overloaded constructor, don't write an empty constructor.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With