## D - Fields problem

• Helmut Leitner (28/28) Mar 30 2003 According to
• Vathix (6/34) Mar 31 2003 If you'll take a look at http://www.digitalmars.com/d/alpha.html you'll
Helmut Leitner <helmut.leitner chello.at> writes:
```According to
<http://www.digitalmars.com/d/class.html>
(example class Abc, about 60 lines down from top)
the following code should be legal, but it doesn't compile:

// setget.d
class Test {
int x;
}

class Test2 {
int xx;
void x(int x) { xx=x; } // set'er
int x() { return xx; }  // get'er
}

int main(char [][] args) {
int i;

Test t=new Test;
t.x=5;
i=t.x;

Test2 t2=new Test2;
t2.x=5; // setget.d(19): cannot implicitly convert int to void(int x)
i=t2.x; // setget.d(20): cannot implicitly convert void delegate(int x) to int

return 0;
}
//end of setget.d

Why?

--
Helmut Leitner    leitner hls.via.at
Graz, Austria   www.hls-software.com
```
Mar 30 2003
"Vathix" <vathix kernel.net> writes:
```If you'll take a look at http://www.digitalmars.com/d/alpha.html you'll
notice at the bottom it states:

Property gettor/settor not implemented.

"Helmut Leitner" <helmut.leitner chello.at> wrote in message
news:3E8767E9.48F4AF91 chello.at...
According to
<http://www.digitalmars.com/d/class.html>
(example class Abc, about 60 lines down from top)
the following code should be legal, but it doesn't compile:

// setget.d
class Test {
int x;
}

class Test2 {
int xx;
void x(int x) { xx=x; } // set'er
int x() { return xx; }  // get'er
}

int main(char [][] args) {
int i;

Test t=new Test;
t.x=5;
i=t.x;

Test2 t2=new Test2;
t2.x=5; // setget.d(19): cannot implicitly convert int to void(int x)
i=t2.x; // setget.d(20): cannot implicitly convert void delegate(int x)

to int
return 0;
}
file://end of setget.d

Why?

--
Helmut Leitner    leitner hls.via.at
Graz, Austria   www.hls-software.com

```
Mar 31 2003