
上QQ阅读APP看书,第一时间看更新
Inheritance and composition
Inheritance allows us to extend an object to specialized versions of some abstract type. In Dart, by simply declaring a class, we are already extending the Object type implicitly. The following also applies:
- Dart permits single direct inheritance.
- Dart has special support for mixins, which can be used to extend class functionalities without direct inheritance, simulating multiple inheritances, and reusing code.
- Dart does not contain a final class directive like other languages, that is, a class can always be extended (have children).