TypeScript的super
(function(){ class Animal{ name:string; constructor(name:string){ this.name=name; } sayHello(){ console.log('动物再叫---'); } } class Dog extends Animal { age:number; constructor(name:string,age:number){ super(name); this.age=age; } sayHello() { // super.sayHello(); console.log('汪汪汪!'); } } const dog=new Dog('旺财',18); dog.sayHello(); })();