Privatize a few members to allow messing with them #11353

matheus matheus at gmail.com
Tue Jun 30 19:58:05 UTC 2020


On Tuesday, 30 June 2020 at 19:55:56 UTC, matheus wrote:
> On Tuesday, 30 June 2020 at 19:46:35 UTC, Stanislav Blinov
>> ...
>>     @safe @nogc pure @property
>>     {
>>         const uint linnum() { return _linnum; }
>>         const uint charnum() { return _charnum; }
>>         void linnum(uint rhs) { _linnum = rhs; }
>>         void charnum(uint rhs) { _charnum = rhs; }
>>     }
>>
>> ...with which the += won't work (at least this variant, as the 
>> getter isn't returning ref).
>
> Oh I see now and thanks for the information.

By the way:

+            loc.linnum = loc.linnum + incrementLoc;

This works because it was declared:

void linnum(uint rhs) { _linnum = rhs; }

Right?

Matheus.


More information about the Digitalmars-d-learn mailing list