Properties
Chad J
gamerchad at __spam.is.bad__gmail.com
Thu Jan 8 22:11:08 PST 2009
Miles wrote:
>
> Both the getter and the setter should return an rvalue. Properties exist
> so that they are interchangeable with real member variables. Something
> that is possible with member variables MUST also be possible with
> properties, in a transparent way for any code outside the class.
>
I agree, though let's not fool ourselves, there is at least one corner case:
property int foo
{
get{ ... }
set{ ... }
}
auto bar = &foo;
what happens when someone writes this?
I've tried this in C# and it is simply forbidden. I am OK with this,
though I'd love it if there was a better way.
More information about the Digitalmars-d
mailing list