5
在TypeScript中声明抽象方法
我试图弄清楚如何在TypeScript中正确定义抽象方法: 使用原始继承示例: class Animal { constructor(public name) { } makeSound(input : string) : string; move(meters) { alert(this.name + " moved " + meters + "m."); } } class Snake extends Animal { constructor(name) { super(name); } makeSound(input : string) : string { return "sssss"+input; } move() { alert("Slithering..."); super.move(5); } …
195
typescript