how to declare an immutable class?

sldkf via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Aug 11 11:43:53 PDT 2016


On Thursday, 11 August 2016 at 17:56:59 UTC, Charles Hixson wrote:
> Does anyone know the correct approach?

I do:

°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
immutable class Foo
{
     this() {}
}

void main()
{
     auto foo = new immutable(Foo);
}
°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°

But take care because you can't do much with an immutable class.


More information about the Digitalmars-d-learn mailing list