On Sunday, 20 July 2014 at 12:48:09 UTC, anonymous wrote:
import std.stdio;interface IBase { template getStr(string fieldName) { final string getStr() { return "George"; } } string getStr(string fieldName); } class Derived: IBase { alias getStr = IBase.getStr; /* order matters, see below */ override string getStr(string fieldName) { return "Sam"; } /* alias getStr = IBase.getStr; /* doesn't work here, I guess that's a compiler bug */ } void main() { auto obj = new Derived; assert( obj.getStr!("aaa")() == "George" ); assert( obj.getStr("aaa") == "Sam" ); }
Sorry, but this example doesn't work too.
