ES6 classes:是否可以从父级访问子级 class 的构造函数?

ES6 classes: is it possible to access the constructor of a child class from the parent?

使用 ES6 class 语法,是否可以从父对象创建当前 class 的新实例?例如:

class Base {
    withFoo() {
        return new self({ foo: true });
    }
}

class Child extends Base {}

(new Child()).withFoo();

我正在寻找类似于 PHP 的 new self() 语法的内容。

您可以通过this.constructor访问当前实例的构造函数。