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