使用 ES6 的 class 的 extends

缺点:基本完美

      class Parent6 {
        constructor(name, age, school) {
          this.name = name
          this.age = age
          this.school = school || '斗罗大陆'
        }

        show() {
          console.log(this.name + this.age + '岁,' + '在' + this.school)
        }
      }
      
      class Child6 extends Parent6 {
        constructor(name, age, school) {
          super(name, age, school)
        }
      }
      
      const c61 = new Parent6('小明', 18, '五道口职业技术学院')
      const c62 = new Child6('小华', 20, '北京大学')
      const c63 = new Child6('小三', 22)

      c61.show() // 小明18岁,在五道口职业技术学院
      c62.show() // 小华20岁,在北京大学
      c63.show() // 小三22岁,在斗罗大陆