class Father {
constructor(x, y) {
this.x = x;
this.y = y;
}
sum() {
console.log(this.x + this.y);
}
say() {
console.log('haha');
}
}
class Son extends Father {
constructor(x, y) {
//使用super调用了父类中的构造函数
super(x, y);
}
// say() {
// console.log('I am Son');
// }
}
let son = new Son(10, 20);
let father = new Father()
son.sum();
son.say();