Sometimes I see properties declared inside the constructor and methods on the outside. What is the difference between declaring methods within the constructor vs outside the constructor?
Bad code. It should be outsite for organization. You can call it inside the constructor if you want it to run when instantiating a class, but it's creationg should be elsewhere, in a more organized way
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Sometimes I see properties declared inside the constructor and methods on the outside. What is the difference between declaring methods within the constructor vs outside the constructor?
Bad code. It should be outsite for organization. You can call it inside the constructor if you want it to run when instantiating a class, but it's creationg should be elsewhere, in a more organized way