www.digitalmars.com         C & C++   DMDScript  

D - bug? cannot implicitly convert int() to int

reply "Carlos Santander B." <carlos8294 msn.com> writes:
The following code produces: "cannot implicitly convert int() to int".

import std.c.stdio;
struct A {
        int b() { return 1; }
}
int x() {
        A a;
        return a.b;
}
void main () {
        printf("%d\n",x());
}

I know I can make work doing "return a.b();", but what would be the purpose
of properties then?

-----------------------
Carlos Santander Bernal
Jan 25 2004
parent Manfred Nowak <svv1999 hotmail.com> writes:
Carlos Santander B. wrote:

[...]
 I know I can make work doing "return a.b();", but what would be
 the purpose of properties then?
It also works with `return a.b + 0;'. Even the example in the docs does not compile, when the `+ 3' is deleted. So long.
Jan 26 2004