T
thomas
It's not a member of a class, so where is it located?
It's said that "this" doesn't exist until we call a member function of
an object and it disappear after the function call. My understanding
is as follows. Correct me if I'm wrong.
~~~~~~~~~~~~~~
Every non-static member function call has the first parameter of
"this".
When calling it somewhere, like
----------code----------
struct A{
public:
void f(){}
};
A a;
a.f();
----------code---------
The "a.f()" is filled as "a.f(&a)". So the "this" pointer (&a here) is
automatically inserted by the compiler.
It's said that "this" doesn't exist until we call a member function of
an object and it disappear after the function call. My understanding
is as follows. Correct me if I'm wrong.
~~~~~~~~~~~~~~
Every non-static member function call has the first parameter of
"this".
When calling it somewhere, like
----------code----------
struct A{
public:
void f(){}
};
A a;
a.f();
----------code---------
The "a.f()" is filled as "a.f(&a)". So the "this" pointer (&a here) is
automatically inserted by the compiler.