D - error with D-style get'ers and set'ers ?
- Röttgar Jones (23/23) Aug 03 2003 hi everybody,
- Matthew Wilson (6/29) Aug 03 2003 AFAIK, properties are still on the to-do list, sadly.
hi everybody, i think i came across an error in the classes reference where it's about the convenient way to avoid different get and set member functions for changing a class' field. using the given example did not compile but gave me an "cannot implicitly convert int to void(int newproperty)" error message. though i am by far not 100% familiar with c-like languages i do think that the syntax is allright. so is it a bug or am i just missing a semicolon? cheers, röttgar jones ps: -- the erroneous code -- class Abc { int myprop; void property(int newproperty) { myprop = newproperty; } // set'er int property() { return myprop; } // get'er } void main() { Abc a; a.property = 3; // equivalent to a.property(3) int x = a.property; // equivalent to int x = a.property() }
Aug 03 2003
AFAIK, properties are still on the to-do list, sadly. "Röttgar Jones" <Röttgar_member pathlink.com> wrote in message news:bgk2ak$898$1 digitaldaemon.com...hi everybody, i think i came across an error in the classes reference where it's abouttheconvenient way to avoid different get and set member functions forchanging aclass' field. using the given example did not compile but gave me an "cannot implicitly convert int to void(int newproperty)" error message. though i am by farnot 100%familiar with c-like languages i do think that the syntax is allright. so is it a bug or am i just missing a semicolon? cheers, röttgar jones ps: -- the erroneous code -- class Abc { int myprop; void property(int newproperty) { myprop = newproperty; } // set'er int property() { return myprop; } // get'er } void main() { Abc a; a.property = 3; // equivalent to a.property(3) int x = a.property; // equivalent to int x = a.property() }
Aug 03 2003