have get'ers and set'ers been implemented yet? Tried using them from the
original example but they don't seem to work
"Burton Radons" <loth users.sourceforge.net> wrote in message
news:aviak5$pe6$1 digitaldaemon.com...

Andrew Edwards wrote:

The following class example taken from the documentation results in an
Access violation error when compiled and executed under WinXP. Does

Here is the code as it originally appeared on the D website:
All this is quite a bit of typing, and it tends to make code unreadable by
filling it with getProperty() and setProperty() calls. In D, get'ers and
set'ers take advantage of the idea that an lvalue is a set'er, and an rvalue
is a get'er:
class Abc
{ int myprop;
void property(int newproperty) { myprop = newproperty; } // set'er
int property() { return myprop; } // get'er
}
which is used as:
Abc a;
a.property = 3; // equivalent to a.property(3)
int x = a.property; // equivalent to int x = a.property()
It does not work. So I had to modify it so that it works somehow. I hadn't
noticed the C++ example above it. Thanks for pointing that out. The problem
still remains though. This code does not work.
Thanks,
Andrew
"Burton Radons" <loth users.sourceforge.net> wrote in message
news:avic2o$qc6$1 digitaldaemon.com...

Here is the code as it originally appeared on the D website:
All this is quite a bit of typing, and it tends to make code unreadable by
filling it with getProperty() and setProperty() calls. In D, get'ers and
set'ers take advantage of the idea that an lvalue is a set'er, and an rvalue
is a get'er:
class Abc
{ int myprop;
void property(int newproperty) { myprop = newproperty; } // set'er
int property() { return myprop; } // get'er
}
which is used as:
Abc a;
a.property = 3; // equivalent to a.property(3)
int x = a.property; // equivalent to int x = a.property()
It does not work. So I had to modify it so that it works somehow. I hadn't
noticed the C++ example above it. Thanks for pointing that out. The problem
still remains though. This code does not work.

Now this example IS a spec bug, as it's in D and doesn't initialise Abc.
Anyway, as to your other question, properties aren't implemented in DMD yet.