By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,778 Members | 1,890 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,778 IT Pros & Developers. It's quick & easy.

this

P: n/a
Can anyone explain to me what the <this> pointer does and what it's used
for? I trying to learn in for COM.

Bill

-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Jul 19 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a

"Bill Cunningham" <so**@some.net> wrote in message
news:3f********@corp.newsgroups.com...
Can anyone explain to me what the <this> pointer does and what it's used
for? I trying to learn in for COM.

It is -
1. A pointer accessible only to nonstatic member functions.
2. A pointer which points to the object for which the member function is
called.
3. Passed by the compiler as a hidden argument to a nonstatic member
function.
E.g. obj.foo (5) can be interpreted as foo (&obj, 5)
4. The expression *this is commonly used to return the current object from a
member function.
return *this;
5. Used to guard against self reference in assignment operator member
function.
if (&Object != this) {
// do not execute in cases of self-reference
6. Non modifiable.

--
JS
Jul 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.