RS> What is the scoop with this?
The keyword `this' ?
RS> BC++ 3.1 tells me it's obsolete. Is that correct?
Assignment to `this' in a constructor is obsolete, yes. In early versions of
the C++ language, *very* early versions, operators new and delete did not
exist for individual classes, and so overriding the default memory allocator
for a particular class was done by assigning to `this' in the middle of a
constructor. However, this mechanism was clumsy and difficult, and has long
since been replaced by class-specific new and delete operators.
Modern C++ implementations, and implementations of *Standard* C++, give
`this' the type `T * const', where `T' is the class, as a consequence of
which it cannot be assigned to.
The keyword `this' is, in itself, *not* obsolete, however.
¯ JdeBP ®
--- FleetStreet 1.19 NR
---------------
* Origin: JdeBP's point, using Squish (2:440/4.3)
|