forbid field name conflict in class hierarchy

Jonathan M Davis jmdavisProg at gmx.com
Mon Nov 15 09:45:26 PST 2010


On Monday, November 15, 2010 06:00:33 Manfred_Nowak wrote:
> Jonathan M Davis wrote:
> > Having public fields shadow each other is problematic.
> 
> Detecting a problem requires having a model.
> What does your model look like?

You're going to have to be more specific in your question than that. It's not at 
all clear what you're asking.

Public and protected functions use polymorphism. Public and protected member 
variables do not. So, it becomes error prone to have public or protected member 
variables which shadow each other. It becomes easy to end up in a situation 
where you're not using the one that you think that you're using - especially 
when code gets changed.

- Jonathan M Davis


More information about the Digitalmars-d mailing list