💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
```js class Person { constructor(name) { this.name = name } drink() { console.log('喝水'); } } // student类继承了 Person类上的所有方法 class Student extends Person { constructor(name, score) { // this.name = name super(name) // 继承 person的参数 this.score = score } introduce() { console.log(`我是${this.name},分数是${this.score}`); } } class Teacher { constructor(name, subject) { this.name = name this.subject = subject } teach() { console.log(`我是${this.name}`); } } const student = new Student('张三', 99) student.introduce() ```