[Issue 2036] New: Hiding rules too restrictive

Janice Caron caron800 at googlemail.com
Fri Apr 25 22:45:23 PDT 2008


On 25/04/2008, d-bugmail at puremagic.com <d-bugmail at puremagic.com> wrote:
>  class Derived : Base
>  {
>     override void foo(int) {}
>  }
>
>  When -w is enabled, the compiler complains that Derived.foo hides Base.foo. In
>  effect, the overriding function properly overrides the second foo in Base but
>  also hides the first foo.
>
>  Probably more permissiveness would be helpful in such cases.

I disagree. It's a valid warning. To make the warning go away, I think
you only have to do:

    class Derived : Base
    {
        override void foo(int) {}
        alias super.foo foo;
    }

(or if that doesn't work, explicitly override both overloads).


More information about the Digitalmars-d-bugs mailing list