js中使用extends实现子类继承父类
//1.父类 ,可以直接理解成原型对象 protorype class persons { constructor(name,age) { this.name = name; this.age = age; } } //2.子类,在class类中使用extends 关键字实现子类继承父类 //语法: class 子类 extends 父类 class EnglishPer extends persons{ } const e1 = new EnglishPer('alan',18); console.log(e1) class ChensePer extends persons{ } const c1 = new ChensePer('张三',25); console.log(c1)