Taken from the cplusplus.com tutorial... I dont really understand what this sentence means...they give this example...i dont understand what's special about it...Quote:
The keyword this represents within a class the address in memory of the object of that class that is being executed. It is a pointer whose value is always the address of the object.
It can be used to check if a parameter passed to a member function of an object is the object itself.
i am not sure what the this pointer is...Code://this
#include <iostream.h>
class CDummy
{
public:
int isitme(CDummy& param);
};
int CDummy::isitme(CDummy& param)
{
if(¶m == this) return 1;
else return 0;
}
void main()
{
CDummy a;
CDummy *b = &a;
if(b->isitme(a))
cout <<"yep, &a is b\n";
else
cout << "nope, don't know this one\n";
}
Thanks in advance!
