Parameter vs. Member variables

前端 未结 9 891
别跟我提以往
别跟我提以往 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:55

    I think the answer is straightforward if you are familiar with C++ destructors. All member variables should be assigned a way to be destructed while function parameters are not. So that's why member variables are usually the states or dependicies of an object having some kind of relation regarding their lifecycle.

提交回复
热议问题