Error: function `...` without `this` cannot be `const`

H. S. Teoh hsteoh at quickfur.ath.cx
Wed Jun 30 20:12:29 UTC 2021


On Wed, Jun 30, 2021 at 07:40:40PM +0000, someone via Digitalmars-d-learn wrote:
[...]
>     @property int data() { return m_data; } // read property
[...]
> string something() @property { return this.whatever; }
[...]
> Now I am not sure which is the correct way.
[...]

Both are correct. :-)  It's up to personal style preference.


T

-- 
2+2=4. 2*2=4. 2^2=4. Therefore, +, *, and ^ are the same operation.


More information about the Digitalmars-d-learn mailing list