forbid field name conflict in class hierarchy
spir
denis.spir at gmail.com
Sun Nov 14 11:41:25 PST 2010
On Sun, 14 Nov 2010 14:22:56 -0500
bearophile <bearophileHUGS at lycos.com> wrote:
> spir:
>
> > I think the compiler should complain when sub-classes hold fields with the same name as super-classes.
>
> I have a bug report on it:
> http://d.puremagic.com/issues/show_bug.cgi?id=5187
You have bug reports for everything and the rest ;-)
> C# faces this problem with the "new" keyword that's denotes a field that the programmer wants to hide:
>
> public class Foo {
> public int x = 10;
> }
> public class Test : Foo {
> new public int x = 20;
> public static void Main() {}
> }
What are use cases for this? (And wouldn't it be better practice to change name even in supposed sensible cases?)
denis
-- -- -- -- -- -- --
vit esse estrany ☣
spir.wikidot.com
More information about the Digitalmars-d
mailing list