class AbstractMobileFactory {
createOS() {
throw new Error('abstract mobile factory can\'t create os' )
}
createWare() {
throw new Error('abstract mobile factory can\'t create ware' )
}
}
class AbstractOs {
controlHardWare() {
throw new Error('abstract os can\'t control ware' )
}
}
class AbstraceWare {
runByOrder() {
throw new Error('abstract ware can\'t run by order' )
}
}
class AppleOs extends AbstractOs {
controlHardWare() {
console.log('I cant control apple ware')
}
}
class AndroidOs extends AbstractOs {
controlHardWare() {
console.log('I cant control android ware')
}
}
class AppleWare extends AbstraceWare {
runByOrder() {
console.log('I cant run by apple order')
}
}
class XiaomiWare extends AbstraceWare {
runByOrder() {
console.log('I cant run by hawei order')
}
}
class AppleMible extends AbstractMobileFactory {
createOS() {
return new AppleOs()
}
createWare() {
return new AppleWare()
}
}
const apple = new AppleMible()
apple.createOS().controlHardWare()
apple.createWare().runByOrder()
console