class zoo { public name:string; public constructor(name:string){ this.name = name; } public sayName(name):void { console.log(this.name); } } class dog extends zoo{ } let checkZooName = new dog("小狗"); console.log(checkZooName.sayName());