【问题标题】:What is Mixin Based Inheritance in Dart?Dart 中基于 Mixin 的继承是什么?
【发布时间】:2019-05-10 23:42:46
【问题描述】:

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

基于 Mixin 的继承意味着虽然每个类(除了 Object) 只有一个超类,一个类体可以在 多个类层次结构。

谁能解释一下?

【问题讨论】:

    标签: inheritance dart dart-pub


    【解决方案1】:

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

    ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀

    【讨论】:

      【解决方案2】:

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

      混合允许从一个超类一个或多个混合类继承方法的实现。

      另见

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-06-28
        • 2011-02-15
        • 2016-08-27
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多