Method Inheritance

Lars Ivar Igesund larsivar at igesund.net
Sun May 14 01:22:27 PDT 2006


John Demme wrote:

> The below code doesn't work unless you uncomment out the alias.  I think
> the reason for this was explained to me at some point, but I don't
> remember. Or
> is it a bug?  I think it should be a bug.

It's by design, believe it or not ;) It's been a while since the last
discussions I think, but it has to do with the overload rules (which
apparently is the same as in C++, but different from those in Java). Walter
is trying to make these rules simple, although IIRC, the corresponding
Java-type rules were equally simple to understand for us mundane. I don't
remember how it affected compiler complexity.

> 
> ~John Demme
> 
> class A
> {
>         void foo (int i)
>         {}
> }
> 
> class B: A
> {
>         void foo (int i, int j)
>         {}
> 
>         /+alias A.foo foo;+/
> }
> 
> void main()
> {
>         B b = new B();
>         b.foo(5,7);
>         b.foo(7);
> }

-- 
Lars Ivar Igesund
blog at http://larsivi.net
DSource & #D: larsivi



More information about the Digitalmars-d-bugs mailing list