Hello ,
I have been studying OOP these days,I read the explanationfor keyword this but didn't get it.Can anyone please tell me how to use it and give me a simple example of it ? I will be thankful.
I have read this http://www.cplusplus.com/doc/tutorial/classes2/
this is the pointer to the class object that will be called
example:
1 2 3 4 5 6 7 8 9 10 11 12
struct S
{
string text;
S ( string t ): text (t);
void method()
{
cout << this->text;
}
};
S object("hello");
object.method();// 'this' would be &object