C Language and Libraries Help (clang.hlp) (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
this
                                             Up Contents Index Back
─────C/C++ Language─────────────────────────────────────────────────────────
 
  Keyword:  this
 
  Syntax:   this
 
  Summary:  The this pointer is a pointer accessible only within
            the member functions of a class, struct, or union type.
            It points to the object for which the member function is
            called. Static member functions do not have a this pointer.
 
     When a nonstatic member function is called for an object, the
     address of the object is passed as a hidden argument to the
     function. For example, the following function call
 
         myDate.setMonth( 3 );
 
     can be interpreted this way:
 
         setMonth( &myDate, 3 );
 
     The object's address is available from within the member function
     as the this pointer. It is legal, though unnecessary, to use the
     this pointer when referring to members of the class. For example:
 
         void Date::setMonth( int mn )
         {
             month = mn;            // These three statements
             this->month = mn;      //     are equivalent
             (*this).month = mn;
         }
 
     The expression (*this) is commonly used to return the current
     object from a member function.
 
     NOTE: Modifying the this pointer is illegal in the latest version
           of C++.
                                    -♦-