Interface and template functions
问题 I'm trying to have interface over two different classes where implementation of a function is in the subclass. It works for regular functions, but unfortunately not for template functions. See example: import std.conv; import std.stdio; interface Num { T num(T)(); } class A : Num { T num(T)() { return 5.to!T; } } class B : Num { T num(T)() { return 2.to!T; } } void main() { auto a = new A(); auto b = new B(); Num somea = a; Num someb = b; writeln(a.num!int()); writeln(somea.num!int());