My problem with const
Adam D. Ruppe via Digitalmars-d
digitalmars-d at puremagic.com
Fri Sep 4 16:48:58 PDT 2015
On Friday, 4 September 2015 at 23:26:39 UTC, Freddy wrote:
> This sample doesn't compile.
That's due to the nature of structs - you would be overwriting a
const field.
Const fields should probably be avoided since they aren't all
that useful. You could instead do a const getter property for it
without a corresponding setter, then make the actual data private.
More information about the Digitalmars-d
mailing list