Static local variables in methods a bad practice?

前端 未结 5 1079
我在风中等你
我在风中等你 2021-01-04 22:44

there is something that\'s bugging me.

In a non-threaded program, is it better to have local static variables(inside methods) or static class members?

In thi

5条回答
  •  执念已碎
    2021-01-04 23:34

    Object-oriented-speaking, bar is part of the state of class C. This is the reason why I usually prefer using fields rather than static local variables.

提交回复
热议问题