Interface inheritance

Simen kjaeraas simen.kjaras at gmail.com
Sun Dec 12 06:56:01 PST 2010


Mandeep Singh Brar <mandeep at brars.co.in> wrote:

> The following code does not compile.
>
> import std.stdio;
> interface A {
>         public void a(int l);
> }
> class ACl:A {
>         public void a(int l) {
>                 writeln("Hello a");
>         }
> }
>
> interface B: A {
>         public void a(string l, int k);
> }
>
> class BCl: ACl, B {
>         public void a(string l, int k) {
>                 writeln("Hello B.a", l, k);
>         }
> }
>
> int main() {
>         B b = new BCl();
>         b.a(1);
>         return 0;
> }
>
> However casting B to A like (cast(A)b).a(1); makes it work.
>
> Regards
> Mandeep

http://d.puremagic.com/issues/enter_bug.cgi
Please file the bug here.

-- 
Simen


More information about the Digitalmars-d-bugs mailing list