Immutable objects and constructor ?

Kagamin via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri May 20 07:40:23 PDT 2016


On Friday, 20 May 2016 at 14:06:54 UTC, chmike wrote:
> But when I try to instantiate the class I get an dramatic 
> compilation error:
>
> "none of the overloads of '__ctor' are callable using a mutable 
> object, candidates are: "

auto a=new immutable Info(1,"1");

> How should I do if I would like to use the lazy pattern for 
> initializing some member variables of the instance ?

Use mutable class.


More information about the Digitalmars-d-learn mailing list