同样,实例化泛型类的客户机类必须使用满足对构造函数存在所声明的约束的类来这样做。
Also, client classes that instantiate our generic class must do so with classes that meet the declared constraint on what constructors exist.
Scala 对构造函数的约束有一些好处。
There are a few advantages of Scala’s constraints on constructors.
这个约束强制任何类型' T '都必须具有无参数的公共构造函数。
This constraint forces any type 't' to have a default constructor, that is, a constructor that takes no parameters.
应用推荐