通用类中的多个约束条件

4

如何在Dart语言的泛型类中执行多个约束

class ClassA<T implements ClassB<T> & ClassC<T>>  {
}

像C#代码一样

class EmployeeList<T> where T : Employee, IEmployee, System.IComparable<T>, new()
{
    // ...
}
1个回答

4

那是不可能的。

最好的方法是创建一个抽象类,同时实现这两个接口,并将其用作约束条件。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接