请考虑以下代码:
abstract class ClassAbstract {
static int _someValue = 10;
ClassAbstract() {}
}
class NormalClass extends ClassAbstract {
NormalClass(): super() {}
void RunMe() {
print("Value from abstract super: $_someValue"); // Error here
}
}
void main() {
NormalClass normalClass = new NormalClass();
normalClass.RunMe();
print("Application close");
}
当我运行它时,我收到一个错误:
Class 'NormalClass' has no instance getter '_someValue@0x213da713'.
NoSuchMethodError : method not found: '_someValue@0x213da713'
Receiver: Instance of 'NormalClass'
Arguments: []
也许我在这里弄错了,但是全局静态变量必须被继承,但是从这个例子中可以看出它没有......