can somebody explain what is "This" operator in C++ -
i know "this" operator used access member functions of invoking object,but can called .so,what use of "this" operator.
i don't think such bad question. not asking does, why keyword exists when implied of time.
here case pointer necessary
class test { int i; void set(int i) { this->i = i; } };
this used select between member variable , function parameter same name.
this used when need address of object within class.
void f(test *p); class test { int i; void pass() { f(this); } };
Comments
Post a Comment