Class and Interface Fun
    John Reimer 
    terminal.node at gmail.com
       
    Sat Jan 24 19:43:55 PST 2009
    
    
  
With this code:
--------------------------------
module test5;
interface I
{
    void foo();
}
class A : I 
{
    void foo() { }
}
class B : A, I
{
    alias A.foo foo;
}
    
void main()
{
}
--------------------------------
I get this error:
--------------------------------
class test5.B interface function I.foo is not implemented
--------------------------------
Does this make sense?  I mean, shouldn't the explicit reuse of A.foo in B 
be sufficient indication to the compiler that B is satisfying the contract 
I?   I'm hoping to make use of such subtleties in some code, but first I 
have to understand the reasoning behind this. :)
Note that this works if I remove the interface I from B's declaration -- 
ie "class B: A" -- since, in the D language, B is not required to fulfull 
A's interface contract even though it inherits from it. 
-JJR
    
    
More information about the Digitalmars-d-learn
mailing list