麦壳社区

ES6多继承

2019-10-07  本文已影响0人  张Boy
const BaseClass = (superClass = null) => {
  superClass = superClass || class Empty {}
  return class extends superClass {
    constructor() {
      super();
    }
  }
}
const BaseClass2 = (superClass = null) => {
  superClass = superClass || class Empty {}
  return class extends superClass {
    constructor() {
      super();
 
    }
  }
}
class MainClass extends BaseClass2(BaseClass1()){
   constructor() {
      super();
    }
}

上一篇 下一篇

猜你喜欢

热点阅读