This rule is Obsolete | |
Synopsis: | Only use the this. construction to avoid a name clash |
Language: | C++ |
Severity Level: | 9 |
Category: | Parts of C++ to Avoid |
Description: |
Do not use the this. construction to dereference members. The use of this is only allowed as a reference to the current class instance or to prevent name clashing between method parameters and class members. A member function shall not use the this keyword to access a data member of member function: void Example::foo() { this->bar(); // wrong (*this).bar(); // wrong bar(); // right this->data = 0; // wrong data = 0; // right } |