Inheritance is a code-reused mechanism in object-oriented programming. You can simply create a new class from an existed class. 1. Defining a Teacher() constructor function Task:
We create a class called Person, and then derive an inherited class(we call it ‘subclass’), Teacher. Useful methods: call function Person(name, age, gender, habit) {
this.name = name;
this.age = age;
this.gender = gender;
this.habit = habit;
}