TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: THOMAS MAEDER
from: ADAM MAJER
date: 1998-02-05 18:29:00
subject: this

TM>RS>  Well, that is the help file I see when I press Ctrl+F1 with
TM>RS>  the cursor under the word "this".   I gather from it that
TM>RS>  there was a time when it was being considered that this should
TM>RS>  be removed from the C++ language standard.
TM>I can't believe that.
The exact wording of the help file: (this is not obsolete - it depends
in what context you use it).
this (C++ keyword)
Use of "this" is now obsolete. A better, safer, and more general
technique is to define a member function called x::operator new instead.
Nonstatic member functions operate on the class type object with which
they are called. For example, if x is an object of class X and func is a
member function of X, the function call x.func() operates on x.
Similarly, if xptr is a pointer to an X  object, the function call
xptr->func() operates on *xptr.
But how does func know which x it is operating on? C++ provides
functions with a pointer to x called "this". "this" is passed as a
hidden argument in all calls to non-static member functions.
The keyword "this" is a local variable available in the body of any
nonstatic member function. The keyword "this" does not need to be
declared and is rarely referred to explicitly in a function definition.
However, it is used implicitly within the function for member
references.
For example, if x.func(y) is called, where y is a member of X, the
keyword "this" is set to &x and y is set to this->y, which is equivalent
to x.y.
 * SLMR 2.1a * All wiyht.  Rho sritched mg kegtops awound?
--- FMail 0.92
---------------
* Origin: The Programmer's Oasis on FIDONET! (1:348/203)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.