This

This is a discussion on This within the C++ Programming forums, part of the General Programming Boards category; can anyone give me a good example of implementing the 'this' pointer in functions and methods for classes? if the ...

  1. #1
    Registered User
    Join Date
    Nov 2001
    Posts
    5

    Post This

    can anyone give me a good example of implementing the 'this' pointer in functions and methods for classes?

    if the answer is yes, cheers! http://www.cprogramming.com/cboard/i...ons/icon14.gif

  2. #2
    zen
    zen is offline
    of Zen Hall zen's Avatar
    Join Date
    Aug 2001
    Posts
    1,007
    Overloaded assignment operator -

    const SomeClass& operator=(const SomeClass& rhs)
    {
    //Check for self assignment
    if(&rhs==this)
    return;
    else
    //Copy stuff

    //return so chaining is possible
    return *this
    }
    zen

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21