Skip to content
字数
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')

// }

贡献者

The avatar of contributor named as sunchengzhi sunchengzhi

文件历史

撰写