【发布时间】:2020-08-18 02:56:28
【问题描述】:
我有一个类A,它扩展了B,并混合了C,如下面的代码。如何让它发挥作用?
class A extends B with C {
@override
int getValue() {
// Call's C's getValue.
super.getValue();
// Now I want to call B's getValue. How do I do that?
return B.getValue(); // Doesn't work.
}
}
class B {
int getValue() {
return 1;
}
}
class C {
int getValue() {
return 2;
}
}
如何执行 B 的getValue?谢谢。
【问题讨论】:
-
this 对您有帮助吗?
-
链接的答案仅告诉您如何重新排序 mixin 以使其中一个可以使用 super 调用。它没有提供一种方法来调用它们中的多个,或者从超类中调用成员,所以我认为它不能回答这个问题。
标签: dart