Immutable fields

Daniel Murphy yebblies at nospamgmail.com
Tue Nov 2 20:06:50 PDT 2010


"bearophile" <bearophileHUGS at lycos.com> wrote in message 
news:iaqbsb$1d30$1 at digitalmars.com...
> Is it correct for immutable struct fields to act like enum or static const 
> fields? (I don't think so, but I am wrong often):
>

immutable struct fields can be changed inside the constructor, so they must 
be non-static.

stuct S
{
    immutable int a;
    this(int b)
    {
        a = b;
    }
} 




More information about the Digitalmars-d mailing list