Immutable

harakim via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Jun 23 07:32:55 PDT 2017


On Friday, 23 June 2017 at 14:29:40 UTC, Adam D. Ruppe wrote:
> On Friday, 23 June 2017 at 14:25:48 UTC, harakim wrote:
>> immutable(AppendChatCommand) command = new 
>> AppendChatCommand(type, text);
>
> try `new immutable AppendChatCommand` instead of just `new`.
>
> If it complains that it cannot call the mutable constructor, go 
> to the class definition and add `pure` to the constructor. 
> Should take care of that error.

Thanks for showing me the right way to do it. My casting strategy 
just lead to a runtime error.


More information about the Digitalmars-d-learn mailing list