Javascriptで基底クラスで子クラスのインスタンスを返す
class Parent { static getChildClass() { return new this() } } class Child extends Parent { static start() { console.log(this.getChildClass()) } } Child.start() // Child {}
class Parent { static getChildClass() { return new this() } } class Child extends Parent { static start() { console.log(this.getChildClass()) } } Child.start() // Child {}