| 9 | // let animal = new Animal() // 不能够实例化,只能被继承 |
| 10 | |
| 11 | class Cat extends Animal{ |
| 12 | constructor(name: string) { |
| 13 | super() |
| 14 | this.name = name |
| 15 | } |
| 16 | name: string |
| 17 | run() {} |
| 18 | sleep() { |
| 19 | console.log('cat sleep') |
| 20 | } |
| 21 | } |
| 22 | let cat = new Cat('喵喵') |
| 23 | cat.eat() |
| 24 | cat.sleep() |
nothing calls this directly
no outgoing calls
no test coverage detected