www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Re: Andrei's interface requests

Andrei Alexandrescu Wrote:

 interface Interface { void foo(); }
 void foo(T : Interface)() { ... }
 class C { void foo(); }
 
 C does not explicitly declare abiding to Interface. However, 
 structurally it does. Should foo be called? If interface is meant for 
 binary binding, no. If interface is meant for concept checking, maybe.

Interface[] rg; interface Interface { void foo(); } void foo(T : Interface)(T i) { rg~=i; } class C { void foo(); } What should happen here? Template will accept C and give error?
Apr 05 2009