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" ); }