切换主题
字数
67 字
阅读时间
1 分钟
js
class People{
constructor(name,age){
this.name = name;
this.age = age;
}
printName(){
console.log(this.name);
}
}
class Students extends People{
constructor(name,age,gender){
super(name,age);
this.gender = gender;
}
eat(){
console.log(`${this.name}正在吃饭`)
}
}
let alex = new Students('Alex',20,'female')
console.log(alex);
alex.eat()
// let studentsType = typeof Students;
// console.log(studentsType)
// if( alex instanceof Students){
// console.log('yes')
// }
贡献者
sunchengzhi