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:
parent
f978e42036
commit
4d2d068702
1 changed files with 3 additions and 3 deletions
|
@ -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()
|
||||
```
|
||||
|
|
Loading…
Add table
Reference in a new issue