Inheritance in ES6

class Human {

    constructor(name, gender) {
        this.name = name;
        this.gender = gender;
    }

    print() {
        console.log('name: ' + this.name);
        console.log('gender: ' + this.gender);
    }

}

class Student extends Human {

    constructor(id, name, gender, score) {
        super(name, gender);
        this.id = id;
        this.score = score;
    }

    print() {
        super.print();
        console.log('id: ' + this.id);
        console.log('score: ' + this.score);
    }

}

class Employee extends Human {
    
    constructor(id, name, gender, salary) {
        super(name, gender);
        this.id = id;
        this.salary = salary;
    }

    print() {
        super.print();
        console.log('id: ' + this.id);
        console.log('salary: ' + this.salary);
    }

}

let student = new Student('st01', 'student 1', 'male', 6.7);
console.log('Student Info');
student.print();

let employee = new Employee('e01', 'Employee 1', 'female', 100);
console.log('Employee Info');
employee.print();
Student Info 
name: student 1 
gender: male 
id: st01 
score: 6.7 

Employee Info 
name: Employee 1 
gender: female 
id: e01 
salary: 100