📜  dart 从泛型继承 - Dart 代码示例

📅  最后修改于: 2022-03-11 14:48:08.529000             🧑  作者: Mango

代码示例1
// available types
class BaseType {}
class DerivedType extends BaseType {}

class BaseClass {
  final Type prop;
  BaseClass(this.prop) {
    // can be either BaseType or DerivedType
    print(prop);
  }
}

class DerivedClass extends BaseClass {
  DerivedClass(BaseType prop) : super(prop);
}