Parameter vs. Member variables

前端 未结 9 941
别跟我提以往
别跟我提以往 2021-01-01 11:15

I\'ve recently been working with someone else\'s code and I realized that this individual has a very different philosophy regarding private variables and method parameters t

9条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-01 11:40

    You should only create variables when and where they are needed, and dispose of them when you are done. If the class doesn't need a class level variable to function, then it just doesn't need one. Creating variables where you don't need them is very bad practice.

提交回复
热议问题