1
0
Fork 0
mirror of https://github.com/tmrts/go-patterns.git synced 2025-04-03 13:13:34 +03:00

Builder pattern

`Usage` Example changed to reflect consistency
This commit is contained in:
Oleg Butuzov 2018-02-18 15:43:42 +02:00
parent f978e42036
commit 4d2d068702

View file

@ -51,11 +51,11 @@ type Interface interface {
## Usage
```go
assembly := car.NewBuilder().Paint(car.RedColor)
assembly := car.NewBuilder().Color(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()
```