飞镖代码:
main() {
print(PPP.name);
print(CCC.name);
}
class PPP {
static String name = "PPP";
}
class CCC extends PPP {
}
它打印:
PPP
Unhandled exception:
No static getter 'name' declared in class 'CCC'.
NoSuchMethodError : method not found: 'name'
Receiver: Type: class 'CCC'
Arguments: [...]
所以在 Dart 中不能访问父类的静态变量?