Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Zortech C++ Language Reference - the this pointer _ http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
                             The this Pointer                         _
   Although  every class object maintains its own copy of the class  data
   members, only one copy of each member function exists. It is necessary
   for the member function to know the identity of the particular  object
   that called it so that it may manipulate the correct data items. Since
   this  is the case, C++ provides the facility to address  the  invoking
   object through the this pointer, a pointer to the invoking object.  It
   is  not  normally  necessary to use the this pointer  to  access  data
   members  or  member  functions of the class,  except  to  resolve  any
   possible  ambiguities. However the use of this is sometimes  required.
   For  instance,  it is possible to return a copy of  the  class  object
   which invoked the member function using the syntax:
   return *this;

   While within the member function, this can be used in the same way  as
   an explicitly declared pointer could be used.


Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson