mutable keyword

ag0aep6g via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri May 20 11:36:18 PDT 2016


On 05/20/2016 08:23 PM, Jack Applegame wrote:
> You can just cast const away:
> struct A {
>      int id = 0;
>
>      this(int id) {
>          this.id = id;
>      }
>
>      void change() const {
>          (cast() id)++;
>      }
> }

That's not a valid D program, though.


More information about the Digitalmars-d-learn mailing list