


```
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()
```