[英]Constructor inheritance in Dart
I found the following statement in Dart documentation :我在Dart 文档中找到了以下语句:
Subclasses don't inherit constructors from their superclass.
子类不从其超类继承构造函数。
What does this mean?这是什么意思?
Remember that constructors are not inherited, which means that a superclass's named constructor is not inherited by a subclass.
请记住,构造函数不是继承的,这意味着超类的命名构造函数不会被子类继承。 If you want a subclass to be created with a named constructor defined in the superclass, you must implement that constructor in the subclass.
如果要使用在超类中定义的命名构造函数来创建子类,则必须在子类中实现该构造函数。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.