Why are there Properties in D?

Francesco Cattoglio francesco.cattoglio at gmail.com
Fri Feb 14 01:54:51 PST 2014


On Friday, 14 February 2014 at 09:32:40 UTC, Robin wrote:
> more important is clean and unambiguous code.
>
> With Properties used in a code a programmer again has to look up
> the definition of all calls and assignments of variables just in
> case they could be Properties and not just member variables.

Trusting the programmer that wrote code before you is something 
you will have to do anyway. Property however have been introduced 
in an "incomplete" way and are discussed once or twice a year in 
huge threads. Anyway, typical usage cases are pretty much the 
same described by C# properties:
from http://msdn.microsoft.com:
-Properties enable a class to expose a public way of getting and 
setting values, while hiding implementation or verification code.


More information about the Digitalmars-d mailing list