我有一个我想要访问的示例用例
MyOtherClass.property1
从派生类的静态方法中,但假设我不知道派生类的名称,我只知道它有这个特定的属性。
对于使用调用的标准类实例
new
我可以使用的关键字
new.target
是的。
是否有某种等效的静态?
class MyClass{
static method1(){
// I want to access MyOtherClass.property1 here
}
}
class MyOtherClass extends MyClass{
static method2(){
}
}
MyOtherClass.property1 = 1;
MyOtherClass.method1();