property/opAddAssign problem
teo
teo.ubuntu.remove at yahoo.com
Tue Dec 29 06:01:38 PST 2009
Consider following:
class A
{
int m;
void opAddAssign(int n) { m += n; }
}
class B
{
A a;
this() { a = new A; }
A Prop() { return a; }
}
void main()
{
B b = new B;
b.Prop += 3;
}
I get a compilation error (dmd v2.037):
test.d(17): Error: 'b.Prop' is not a scalar, it is a A()
test.d(17): Error: incompatible types for ((b.Prop) += (3)): 'A()' and
'int'
Am I doing something wrong, or is this a known issue with opAddAssign and/
or properties?
More information about the Digitalmars-d-learn
mailing list