Have you got a small example?

import std.stdio;

class Test{
        private int number;

public void setNumber( int newValue ) shared{ number = newValue; }

        public int getNumber() shared{ return number; }
}

void main(){
        auto test = new Test();

        (cast(shared)test).setNumber( 5 );

        writeln("Value = ", (cast(shared)test).getNumber() );
}

But do not forget the fact that because of the object `test` is not shared, therefore the attribute `number` is not shared. Thus, this will not be working multi-threded.

Reply via email to