class father{
get fruit(){
return 'apple'
}
eat(){
console
.log('我要吃苹果'+this.fruit
)
}
constructor(){
this.eat
=this.eat
.bind(this)
}
}
class Son{
get fruit(){
return 'apple1'
}
eat(){
console
.log('我要吃苹果1'+this.fruit
)
}
}
var son1
=new Son();
var father1
=new father();
son1
.eat
=father1
.eat
son1
.eat()
转载请注明原文地址: https://lol.8miu.com/read-4403.html