Properties don't behave like variables?
Mehrdad
wfunction at hotmail.com
Mon May 7 13:15:54 PDT 2012
On Monday, 7 May 2012 at 12:43:42 UTC, Steven Schveighoffer wrote:
> On Sun, 06 May 2012 22:05:20 -0400, Mehrdad
> <wfunction at hotmail.com> wrote:
>
>> Why doesn't this compile?
>>
>> @property int foo() { return 1; }
>> @property void foo(int v) { }
>>
>> void main()
>> {
>> foo |= 2;
>> }
>
> It's like this in C#.
Um, I to differ...
This compiles just fine in C#:
class Program
{
static int Prop { get { return 0; } set { } }
static void Main()
{
Prop |= 1;
}
}
More information about the Digitalmars-d
mailing list