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

Johan Lermer johann.lermer at elvin.eu
Thu Jul 1 19:15:50 UTC 2021


On Wednesday, 30 June 2021 at 19:40:40 UTC, someone wrote:
> Let's use @property instead of const:
>
> ```d
> struct Foo
> {
>     @property int data() { return m_data; } // read property
>
>     @property int data(int value) { return m_data = value; } // 
> write property
>
>   private:
>     int m_data;
> }

Isn't @property kind of deprecated?



More information about the Digitalmars-d-learn mailing list