is there "this"?
Konstantin Kutsevalov via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri Nov 4 19:43:16 PDT 2016
On Thursday, 3 November 2016 at 13:40:11 UTC, Steven
Schveighoffer wrote:
> On 11/2/16 4:43 AM, Jonathan M Davis via Digitalmars-d-learn
>
> In the case of the original post, however, you *need* to use
> this.value, as the parameter masks the member of the same name.
> Using 'this' removes ambiguity.
>
> This is a typical pattern seen in many languages. Often the
> intuitive name of a member is the same name as you want for the
> parameter of the constructor.
>
> -Steve
I'd like to use "this" because when I see something like
"this.pumpurum = 10;" then I understand that "pumpurum" is
property of class and not some local variable :)
More information about the Digitalmars-d-learn
mailing list