forbid field name conflict in class hierarchy

Jonathan M Davis jmdavisProg at gmx.com
Mon Nov 15 02:45:34 PST 2010


On Monday 15 November 2010 02:29:55 Stanislav Blinov wrote:
> Daniel Gibson wrote:
> > Disallowing public fields is too restrictive IMHO.
> 
> Maybe. I just always view public fields as encapsulation breakers. And
> silent invariant breakers. And maintenance cripplers :)

Personally, it's the kind of thing that I generally avoid, but there are 
situations where it makes good sense to have them. I think that it's one of 
those cases where the programmer should have the freedom to choose. Most of the 
time that choice should probably be property functions over public member 
variables, but forcing the issue is definitely too restrictive.

- Jonathan M Davis


More information about the Digitalmars-d mailing list