dart - limit T in a generic class to types that implement some interface -
in dart consider following
class question<t>{ string body; t answer; } //an interface class ianswer{ string value()=>this.tostring(); }
i need t limited types example implement interface ianswer, possible without having check if t ianswer , throw , exception in question constructor?
class question<t extends ianswer>{ string body; t answer; }
Comments
Post a Comment