Problem with Point property

Manfred Nowak svv1999 at hotmail.com
Tue Mar 6 14:02:16 PST 2007


Henning Hasemann wrote

> this would break expressions like
> Foo().position.x = 5;
> which I happen to use often.

The problem ´seems to stem from the often used breaking of the data 
encapsulation in the class Foo.

I already wrote about my _feeling_ that using properties as substitutes 
for field accesses is inherently wrong because it also breaks data 
encapsulation.

Getters might be better seen as delegates, capable of answering 
questions about the state of the instance they stem from at that point 
in time when they were requested.

-manfred



More information about the Digitalmars-d mailing list