class Father {
constructor(surname) {
this.surname = surname;
}
say() {
console.log('你的姓是' + this.surname);
}
}
class Son extends Father {
// 这样子类就继承了父类的属性和方法
}
var damao = new Son('刘');
damao.say();
上面是代码,下面图片是报错