Hello
In many OOP languages "this"(or something similar) is used to point to current object. But i think its an object by itself. Here is what i found" polymorphic object which can point in different times to different object`s types"
I like to get some more information about this maybe some science article.
Thank you in advance.
class A
{
public:
A()
{
x = 0;
cout << "A: this = " << hex << (unsigned int)this << "\n";
}
private:
int x;
};
class B : public A
{
public:
B()
{
y = 0;
cout << "B: this = " << hex << (unsigned int)this << "\n";
}
private:
int y;
};
int main(int argc, char* argv[])
{
B b;
}
Its just a Compilers way of saying "The main object under my concern right now is this" ,as AncientDragon has stated its just a pointer which is maintained completely by compiler which the user cannot modify,but can make use of it foir referencing the current object.For more info try these 12.
Last edited by csurfer; Jul 4th, 2009 at 11:53 pm.
No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.