mirror of
https://github.com/swc-project/swc.git
synced 2024-12-19 03:31:45 +03:00
23 lines
536 B
JavaScript
23 lines
536 B
JavaScript
|
function Mixin(baseClass) {
|
||
|
return class extends baseClass {
|
||
|
mixinMethod() {
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
class ConcreteBase {
|
||
|
baseMethod() {
|
||
|
}
|
||
|
}
|
||
|
class AbstractBase {
|
||
|
}
|
||
|
class DerivedFromConcrete extends Mixin(ConcreteBase) {
|
||
|
}
|
||
|
const wasConcrete = new DerivedFromConcrete();
|
||
|
wasConcrete.baseMethod(), wasConcrete.mixinMethod();
|
||
|
class DerivedFromAbstract extends Mixin(AbstractBase) {
|
||
|
abstractBaseMethod() {
|
||
|
}
|
||
|
}
|
||
|
const wasAbstract = new DerivedFromAbstract();
|
||
|
wasAbstract.abstractBaseMethod(), wasAbstract.mixinMethod();
|