On Wednesday, 30 June 2021 at 20:12:29 UTC, H. S. Teoh wrote:
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

Just to remark here, if you want to apply const to a return type put it inside brackets like: const(MyClass) foo(); otherwise compiler will try to apply it to 'this' parameter.

Best regards,
Alexandru.

Reply via email to