Interface inheritance

GGB via Digitalmars-d digitalmars-d at puremagic.com
Tue Sep 5 13:15:44 PDT 2017


What are the rules regarding one interface (not class, but 
interface) inheriting from another?

Nothing in the documentation seems to refer to interface 
inheritance, only to class inheritance.

I have tried to do some code with this, and the compiler does not 
complain about one interface inhering from another, but it does 
give some strange results when the child interface tries to 
implement an abstract method in the parent interface.

What I am trying to do in structurally like this:

interface I1
{
     abstract x *A();
}

interface I2: I1
{
     final x *A() { ... }
     final int B() { return f(A()); }
}

interface I3: I1
{
     final int C() { return g(A()); }
}

class C1: I3
{
     final x *A() { ... }
}

class C2: I2
{
    // should not need to define A() because that should be 
defined in I2
    // Not allowed to define A() because already defined in I2
}


More information about the Digitalmars-d mailing list