Implementing interfaces using alias this
    Balagopal Komarath via Digitalmars-d-learn 
    digitalmars-d-learn at puremagic.com
       
    Wed Jun 14 02:34:27 PDT 2017
    
    
  
Why doesn't this work? The Test!Duck type has a void quack() 
method but the compiler says it is not implemented.
import std.stdio;
interface IDuck
{
     void quack();
}
class Test(T) : IDuck
{
     T data;
     alias data this;
}
struct Duck
{
     void quack()
     {
         writeln("Quack");
     }
}
void main()
{
	Test!Duck d;
}
    
    
More information about the Digitalmars-d-learn
mailing list