Class Inheritance in OOP in JavaScript
One class can inherit from another class, borrowing its methods and properties. This is useful when two classes are very similar. For example, we can have a class User, and also Student, which has the same properties and methods, but also adds its own. In this case, it would be convenient for the student to inherit the parent's duplicate methods. Let's see how this is done.
Let's say we have a class User, which will be a parent:
javascriptclass User {
}
Let us also have a class with a student, which will be a child:
javascriptclass Student {
}
Let's make the child class inherit the methods and properties of its parent. This is done using the extends keyword property:
javascriptclass Student extends User {
}
Задание 1
Make class Employee inherit from class User.