c++ - When is 'this' required? -


is this pointer ever required? guess you'd need if functionally passing around instance of class pointed this. in terms of setting/retrieving/calling/whatever members, this optional?

i've tagged c++ because that's language i'm wondering about, if can confirm construct same java , other oo languages use this pointer, it'd appreciated.

you need when have local variable has exact same name member variable. in case, local variable said shadow member variable. member variable in situation, must use this.

some people consider practice explicitly mention variable modifying member variable using this time, not case.


Comments

Popular posts from this blog

jasper reports - Fixed header in Excel using JasperReports -

media player - Android: mediaplayer went away with unhandled events -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -