企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
![](https://box.kancloud.cn/c2654e09ace71fa1ee5419fb45d47573_802x320.png) ![](https://box.kancloud.cn/6c6c55b2dd43c61fa60735bd64b9f15f_419x134.png) ![](https://box.kancloud.cn/d651e6b5634e620a8e9583b04753da96_798x369.png) ``` class Car { constructor(number, name) { this.number = number this.name = name } } class Kuaiche extends Car { constructor(number, name) { super(number, name) this.price = 1 } } class Zhuanche extends Car { constructor(number, name) { super(number, name) this.price = 2 } } class Trip { constructor(car) { this.car = car } start() { console.log(`行程开始,名称: ${this.car.name}, 车牌号: ${this.car.price}`) } end() { console.log('行程结束,价格: ' + (this.car.price * 5)) } } let car = new Kuaiche(100, '桑塔纳') let trip = new Trip(car) trip.start() trip.end() ```