<script type="text/javascript">
class Human {
constructor(name) {
this.name = name
this.kingdom = 'animal'
this.color = ['yellow', 'white', 'brown', 'black']
}
// 补全代码
getName(){
return this.name;
}
}
// 补全代码
class Chinese extends Human{
constructor(name,age){
// this.name=name;
super(name);
this.age=age;
}
getAge(){
return this.age;
}
}
</script>
JS13 类继承
最新推荐文章于 2024-05-20 15:17:08 发布