Thread overview
Multiple interface implementation doesn't seem to work quite right.
May 30, 2004
Andy Friesen
Jun 01, 2004
Walter
Jun 27, 2004
Kris
May 30, 2004
test.d:

    interface I1
    {
        void i1();
    }

    interface I2
    {
        void i2();
    }

    interface I3 : I1, I2
    {
    }

    class C1 : I3
    {
        void i1() { printf("i1\n"); }
        void i2() { printf("i2\n"); }
    }

    void f1(I1 i1, I2 i2)
    {
        i1.i1();
        i2.i2();
    }

    int main()
    {
        I3 i3 = new C1();
        f1(i3, i3);
        return 0;
    }

Yields the output:

i1
i1

 -- andy
June 01, 2004
Argh. This is a particularly nasty one. Anyhow, it's fixed now :-)


June 27, 2004
I ran into more diamond-shaped interface problems last night, when combined with the "multiple derivation" shown below. The vTable gets seriously borked in such cases; it's exasperating :-(


"Andy Friesen" <andy@ikagames.com> wrote in message news:c9ctoa$10k$1@digitaldaemon.com...
> test.d:
>
>      interface I1
>      {
>          void i1();
>      }
>
>      interface I2
>      {
>          void i2();
>      }
>
>      interface I3 : I1, I2
>      {
>      }
>
>      class C1 : I3
>      {
>          void i1() { printf("i1\n"); }
>          void i2() { printf("i2\n"); }
>      }
>
>      void f1(I1 i1, I2 i2)
>      {
>          i1.i1();
>          i2.i2();
>      }
>
>      int main()
>      {
>          I3 i3 = new C1();
>          f1(i3, i3);
>          return 0;
>      }
>
> Yields the output:
>
> i1
> i1
>
>   -- andy