Possible duplicates:Is there a reason to use this->When should it> use?When should I use the pointer explicitly this?
this
When working with pointers to classes, I would like to add this->in front of the variables in the class to make it clearer that the variable I'm talking about is in the current class, as opposed to temporary variables, etc. So my lines will be something like
this->
if(this->thing > other->thing) this->doFoo();
Instead
if(thing > other->thing) doFoo();
Is it possible to add superfluous this, or will it impair code readability?
Consistency of sequence.
this-> , , .
, . m_. , -, → :
m_
(alpha-this->gamma > this->alpha-gamma)
.
(alpha-m_gamma > m_alpha-gamma)
(dotNetties m_ - # - , .)
, , intellisense - , , .
,
_myVariable m_myVariable myVariable_
- .
-
, . , , - m_, , . (m_foo this->foo.) , , , . YMMV. , , .
m_foo
this->foo
( , , ), this-> , , , , , :
foo bar; void f(foo bar) { this->bar = bar; }
, , , .
- ( m prefix), :
m
, , , this-> . 6 .
, , "". - , , .
this, - . ( -)
, ,
void CMYClass::fun1(int sameName) { ... this->sameName = sameName; }
...
Source: https://habr.com/ru/post/1786587/More articles:Line button margin - androidDjango ModelForm save () method issue - pythonHow to make an archive that is a parsing pointer? - c ++Ajax request from Blackberry Phonegap app - ajaxWhat is the lexer naming convention? - phpEclipse not removing obsolete classes? - javahttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1786589/detect-if-windows-phone-7-is-connected-to-desktop-zune-software&usg=ALkJrhjgD1y66uvgRhIwGdr7t2YGcZ_yRAUsing gdb in Emacs splits horizontal scrolling - emacshttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1786591/are-there-any-ways-to-embed-open-office-into-my-application&usg=ALkJrhi0PkBySdhCbK4xc20mO6Hsc6a0DANano на сервере игнорирует определенную окраску синтаксиса - syntax-highlightingAll Articles