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
Post a Comment