How do I create a module-local immutable class object?

Jonathan M Davis jmdavisProg at gmx.com
Fri Sep 9 14:53:37 PDT 2011


On Friday, September 09, 2011 23:47:32 Andrej Mitrovic wrote:
> For crying out loud, shared fails too:
> 
> class Foo
> {
>     shared this()
>     {
>         value = true;
>     }
> 
>     @property bool value() { return true; }
>     @property void value(bool value) { }
> }
> 
> void main()
> {
>     auto foo1 = new Foo;
>     auto val1 = foo1.value;  // fail
> }

I meant to make the static constructor shared.


More information about the Digitalmars-d-learn mailing list