I am trying to print out the name of class B or C in it's super class (A). Is there a way to infer this somehow from the context? Do I have to pass in the names into super as a parameter or is there a better way of doing this?
class A {
constructor(){
console.log(klass_name) // klass_name is some code to get the name of class B,C
}
}
class B extends A {
constructor() {
super();
}
}
class c extends A {
super();
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…