Defining Local Variable const vs Class const

后端 未结 6 1204
时光说笑
时光说笑 2020-12-30 18:12

If I am using a constant that is needed only in a method, is it best to declare the const within the method scope, or in the class scope? Is there better pe

6条回答
  •  执笔经年
    2020-12-30 18:53

    I would put it in the method itself. I'm not a fan of variables that hang around in scope when they don't need to be there.

提交回复
热议问题