mirror of
https://github.com/tmrts/go-patterns.git
synced 2024-11-24 22:16:12 +03:00
creational/builder: change wheels to more appropriate
Sports car is expected to have sports wheels, while family car may have steel wheels
This commit is contained in:
parent
f978e42036
commit
b3eb3225a6
@ -53,9 +53,9 @@ type Interface interface {
|
||||
```go
|
||||
assembly := car.NewBuilder().Paint(car.RedColor)
|
||||
|
||||
familyCar := assembly.Wheels(car.SportsWheels).TopSpeed(50 * car.MPH).Build()
|
||||
familyCar := assembly.Wheels(car.SteelWheels).TopSpeed(50 * car.MPH).Build()
|
||||
familyCar.Drive()
|
||||
|
||||
sportsCar := assembly.Wheels(car.SteelWheels).TopSpeed(150 * car.MPH).Build()
|
||||
sportsCar := assembly.Wheels(car.SportsWheels).TopSpeed(150 * car.MPH).Build()
|
||||
sportsCar.Drive()
|
||||
```
|
||||
|
Loading…
Reference in New Issue
Block a user