this

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Bill Cunningham

    this

    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! =-----
  • Josephine Schafer

    #2
    Re: this


    "Bill Cunningham" <some@some.ne t> wrote in message
    news:3f42f551_7 @corp.newsgroup s.com...[color=blue]
    > Can anyone explain to me what the <this> pointer does and what it's used
    > for? I trying to learn in for COM.
    >[/color]
    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


    Comment

    Working...