class Person{ constructor(name,age){ //直接写属性 this.name=name; this.age=age; console.log(‘a‘); } showName(){ //直接可以写方法 return this.name } showAge(){ return this.age } } class Student extends Person{ showJob(){ // return this.job } } var xiaohua=new Student();//a var xiaolv=new Student();//a
原文:https://www.cnblogs.com/mlh1421/p/10804505.html