Should I use the same name for a member variable and a function parameter in C++?

前端 未结 9 1802
自闭症患者
自闭症患者 2020-12-08 03:08

I am wondering if it is a good practice to use the same name for both a member variable and a function parameter in C++.

I come from a Java backgro

9条回答
  •  萌比男神i
    2020-12-08 03:41

    There is not really any difference between the C++ and Java, the only drawback is that you have to type this->state = state instead of state = arg.

    But your code is perfectly acceptable, it's more of styling than anything else.

提交回复
热议问题