class Person {
constructor (name) {
this.name = name
}
say () {
console.log(hi, my name is ${this.name})
}
}
class Student extends Person { // 让student 继承Person
constructor (name, number) {
super(name) // 父类构造函数
this.number = number
}
hello () {
super.say() // 调用父类成员
console.log(my school number is ${this.number})
}
}
const s = new Student('jack', '100')
s.hello()