Immutable member functions on mutable objects
Tomek Sowiñski
just at ask.me
Sun Nov 29 04:31:36 PST 2009
Tomek Sowiñski Wrote:
> I've got a problem calling an immutable getter on an "ordinary" object.
> [snip]
Weird: if I reverse the situation -- the object is immutable and function is ordinary -- I also get an error.
struct A {
float _pole;
float pole() {
return _pole;
}
}
void main() {
immutable A a;
auto x = a.pole; // Ouch!
}
Error: function hello.A.pole () is not callable using argument types ()
Tomek
More information about the Digitalmars-d-learn
mailing list