1
0
mirror of https://github.com/tmrts/go-patterns.git synced 2024-11-28 16:06:07 +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:
Vladislav Klimenko 2024-10-16 21:05:29 +03:00 committed by GitHub
parent f978e42036
commit b3eb3225a6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -53,9 +53,9 @@ type Interface interface {
```go ```go
assembly := car.NewBuilder().Paint(car.RedColor) 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() familyCar.Drive()
sportsCar := assembly.Wheels(car.SteelWheels).TopSpeed(150 * car.MPH).Build() sportsCar := assembly.Wheels(car.SportsWheels).TopSpeed(150 * car.MPH).Build()
sportsCar.Drive() sportsCar.Drive()
``` ```