is there "this"?
Konstantin Kutsevalov via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Nov 1 19:33:10 PDT 2016
On Wednesday, 2 November 2016 at 02:20:43 UTC, rikki cattermole
wrote:
> On 02/11/2016 3:17 PM, Konstantin Kutsevalov wrote:
>> The question is simple.
>>
>> Is there something like "this" word for classes?
>>
>> For example:
>>
>> ```
>> class CLS {
>>
>> int numberValue;
>>
>> public this(numberValue)
>> {
>> // how can I put the local numberValue to class
>> property?
>> // in some prog language I can do like:
>> // this.numberValue = numberValue;
>> }
>>
>> }
>> ```
>
> You forgot an int in the arguments but otherwise that would
> work fine with your line uncommented.
yes I missed "int", but it's just an example.
so if I'll write "this.property = value" it will work?
More information about the Digitalmars-d-learn
mailing list