TS 定义一个抽象类(不允许被实例化)

index.ts

abstract class Foo {
  constructor() {}
  className = "Foo";
}

class FooChild extends Foo {
  constructor() {
    super();
  }
}

// const foo = new Foo(); // Error

const fooChild = new FooChild();
fooChild.className; // "Foo"
上一篇:php数组的循环


下一篇:排他思想js