I have no class
Dave Angel
davea at davea.name
Mon Nov 24 00:20:41 EST 2014
On 11/24/2014 12:11 AM, Dave Angel wrote:
> On 11/23/2014 11:21 PM, Steven D'Aprano wrote:
>
>> In some of these languages, the use of "this/self/me" is optional, but
>> I'm not aware of *any* OOP language where there is no named reference to
>> the current object at all.
>>
>
> The case I found astounding in C++ was in the initializer list where the
> line
>
> value:value
>
> would assume that the first one was this->value, and the second was a
> local named value (usually an argument to the constructor).
>
>
That was rather sloppy. Since this is only used in a constructor, and
it appears before the body of the function/method, the second one must
be an argument, or else something non-local.
Anyway, the construct is a bit of a surprise the first time you see it.
--
DaveA
More information about the Python-list
mailing list