Properties don't behave like variables?

Jacob Carlborg doob at me.com
Mon May 7 14:14:36 PDT 2012


On 2012-05-07 22:16, Michael wrote:
> import std.stdio;
>
> int pro = 1;
>
> @property ref auto prop()
> {
>        return pro;
> }
>
> @property void prop(int value)
> {
>        pro = value;
> }
>
> void main()
> {
>        writeln(prop |= 2);
> }

You're bypassing the getter.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list