mirror of
https://github.com/swc-project/swc.git
synced 2024-12-21 12:41:54 +03:00
26 lines
562 B
JavaScript
26 lines
562 B
JavaScript
function Mixin(baseClass) {
|
|
class MixinClass extends baseClass {
|
|
mixinMethod() {
|
|
}
|
|
}
|
|
return MixinClass;
|
|
}
|
|
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();
|