property returning a reference vs returning a value
cal
callumenator at gmail.com
Tue Jun 19 20:42:25 PDT 2012
This doesn't compile, because the assignment matches both
property functions in S:
struct S
{
@property int a() { return _a; }
@property ref int a() { return _a; }
int _a;
}
int main()
{
S s;
s.a = 5;
}
But I would like to be able to do different things when I pass
out a reference to _a compared to when I just pass out the value.
I also don't want to require an argument to the ref property
function. Is there a way to do this?
Thanks,
cal
More information about the Digitalmars-d-learn
mailing list