【发布时间】:2011-10-10 09:56:37
【问题描述】:
可能重复:
Is excessive use of this in C++ a code smell
When should you use the "this" keyword in C++?
Is there any reason to use this->
在 C++ 中,关键字this 通常会被省略吗?例如:
Person::Person(int age) {
_age = age;
}
相对于:
Person::Person(int age) {
this->_age = age;
}
【问题讨论】:
-
大多数人在传递给函数的变量与实例变量同名时使用它...