class Phone {
constructor (brand,price) {
this.brand = brand
this.price = price
}
call () {
console.log('我可打电话')
}
}
class smartPhone extends Phone{
constructor (brand,price,color,size){
super(brand,price)//super 继承父类的
this.color = color
this.size = size
}
photo () {
console.log('我可以拍照')
}
playgame () {
console.log('我可以 玩游戏')
}
// 重写父类的call 方法 但只是当前的实例化是重写了 影响上级的上级 call
call () {
console.log('我可以 重写')
}
}
var smart_phone = new smartPhone('锤子','2499','balck','5.5inch')
console.log(smart_phone)
smart_phone.call()
console