クラス継承

514 ワード



class People{
    constructor(name,age){
        this.name = name;
        this.age = age;
    },
    sayHide(){
        console.log(
        `  :${this.name},   ${this.age}`
        )
    }
}


const xiaoming = new People('xiaoming','19');
xiaoming.sayHide();

class Student extends People{
    constructor(name,number){
        super(name);
        this.number = number;
    },
}
const wang = new People('wang',1);