Properties don't behave like variables?

Michael pr at m1xa.com
Mon May 7 13:16:26 PDT 2012


On Monday, 7 May 2012 at 02:05:21 UTC, Mehrdad wrote:
> Why doesn't this compile?
>
> @property int foo() { return 1; }
> @property void foo(int v) { }
>
> void main()
> {
> 	foo |= 2;
> }


import std.stdio;

int pro = 1;

@property ref auto prop()
{
       return pro;
}

@property void prop(int value)
{
       pro = value;
}

void main()
{
       writeln(prop |= 2);
}

No?

// dmd 2.059



More information about the Digitalmars-d mailing list