// 如何定义一个类,如何在类里面定义属性和方法 class Person2 { name = "dell"; getName() { return this.name; } } // Perso2是父类,Teacher2是子类 class Teacher2 extends Person2 { getTeacherName() { return "dell"; } getName() { return super.getName() + "lee"; } } const person = new Person2(); console.log(person.getName()); const teacher2 = new Teacher2(); console.log(teacher2.getTeacherName());