[Issue 2036] Hiding rules too restrictive

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Apr 26 12:51:25 PDT 2008


http://d.puremagic.com/issues/show_bug.cgi?id=2036





------- Comment #9 from andrei at metalanguage.com  2008-04-26 14:51 -------
(In reply to comment #8)
> So, whenever a function of an overload set is overriden, the language shouldn't
> require all functions of the overload set to be overriden, but only those with
> the same number of parameters (which are the ones susceptible of being called
> errounesly)? 
> (and those with default parameters values too)

Probably even more permissive. The rule of thumb is that the overriding
function must not hijack any other in the base class. Consider:

class Base
{
    void foo(int);
    void foo(string[string]);
}

class Derived
{
    override void foo(int);
}

This should go through because there's no chance I could pass an int and expect
the overload taking a hash to kick in.


-- 



More information about the Digitalmars-d-bugs mailing list