class Animal{
protected name: string;
static age=18
constructor (name:string){
this.name=name
}
run(){
return `${this.name}`
}
}
const snake=new Animal("geyao")
console.log(Animal.age)
class Dog extends Animal{
bark(){
return `${this.name}`
}
}
const dog=new Dog("geyao")
class Cat extends Animal{
bark(){
return `${this.name}`
}
}
const cat=new Cat("geyao")
标签:12,geyao,name,react18,Animal,return,class,const
From: https://www.cnblogs.com/yao-655442/p/16629136.html