class A {
static MESSAGE = 'A class';
getA() {
return Object.getPrototypeOf(this).constructor.MESSAGE
}
}
class B extends A {
static MESSAGE = 'B class';
}
class C extends A {}
class D extends B {}
let a = new A
let b = new B
let c = new C
let d = new D
console.log(a.getA()); // A class
console.log(b.getA()); // B class
console.log(c.getA()); // A class
console.log(d.getA()); // B class