[Design] return char[] or string?
Manfred Nowak
svv1999 at hotmail.com
Thu Aug 23 11:02:47 PDT 2007
Regan Heath wrote
> "Properties are member functions that can be syntactically treated
> as if they were fields"
>
> I was under the impression the main benefit to properties was
> being able to replace an existing field (one in use by some user
> code) with a property and have it work without user code changes.
For me the definition implies that fields can replace properties, but
no property can replace a field.
I read the definition above like this:
: if a member function can be syntactically treated as a field, then
: it is a property
i.e., properties have less syntactical power than fields.
Because member functions with at most one formal parameter can be
treated as fields in assignments, i.e. without the parentheses, D has
properties according to the definition in the docs.
All those recognizable errors in yours and Stewart's examples are
based on the wrong assumption, that properties are more powerful than
fields.
-manfred
More information about the Digitalmars-d-learn
mailing list