ES6中 子类可以通过extends 继承 父类,子类中属性 必须涵盖 父类的属性,这需要通过super实现,在此基础上可以增加特有的属性,super 中务必包含父类属性,不然新增的属性,会覆盖所要继承的父类属性
class Person(){constrator(name,age){this.name = name;this.age = age}showName(){return this.name}showAge(){return this.age}}class workder extends Person{constructor(name,age,job="default"){super(name,age)this.job = job}showJob(){return this.job}}
