MCPcopy Create free account
hub / github.com/SincereCSL/Playgrounds / constructor

Method constructor

TypeScript/StudyTypeScript/src/class_01.ts:24–29  ·  view source on GitHub ↗
(name: string, public color: string)

Source from the content-addressed store, hash-verified

22// 类:类的继承
23class Husky extends Dog {
24 constructor(name: string, public color: string){
25 super(name)
26 this.color = color
27 this.pro() // 受保护成员子类中可以访问
28
29 }
30 // color: string
31}
32console.log(Husky.food) //类的静态成员可以被继承,子类调用

Callers

nothing calls this directly

Calls 1

proMethod · 0.80

Tested by

no test coverage detected