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;
}

Off hand I would say because it doesn't go to anything (Open the box... What do you mean what box? That invisible one over there can't you see it!?)...

Might be better to ask in D.learn, I try and refrain topics unless it actually is in more depth or requires advanced answers.

Consider...

@property int sq(int x) { return x * x;}

void main(){
  int x = 5;
  writeln(x.sq); //should print 25
}

Reply via email to