Weird template error
Brian
digitalmars at brianguertin.com
Wed Nov 19 13:59:22 PST 2008
I don't understand why we wouldn't want properties either. Another issue
I've had a couple times, although there might be a good reason for this
I'm not aware of:
class Foo {
int x;
}
void set(inout int x) {
x = 10;
}
void main() {
auto foo = new Foo();
set(foo.x); // This works fine
}
But then if you need to make x a property:
class Foo {
int _x;
int x() { return _x; }
int x(int val) { return _x = val; }
}
You get "Error: foo.x() is not an lvalue"
More information about the Digitalmars-d
mailing list