Dart 中基于 Mixin 的继承是什么?

What is Mixin Based Inheritance in Dart?

这是官方文档对Mixin Based Programming的定义,

Mixin-based inheritance means that although every class (except for Object) has exactly one superclass, a class body can be reused in multiple class hierarchies.

谁能解释一下?

Mixins 是减少单继承限制的有限方式(与例如 C++ which allows multiple inheritance 相反)

混合允许从一个超类一个或多个混合类.[=12=继承方法的实现]

另见

  • When to use mixins and when to use interfaces in Dart?

来自https://medium.com/flutter-community/dart-what-are-mixins-3a72344011f3

⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀†⠀⠀†††††† ⠀⠀⠀⠀