forked from betty200744/ultimate-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuilder.go
41 lines (36 loc) · 756 Bytes
/
builder.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package builder
type iBuilder interface {
setWindowType(windowType string)
setDoorType(doorType string)
setNumFloor(numFloor int)
getHouse() house
}
type normalBuilder struct {
windowType string
doorType string
floor int
}
type house struct {
windowType string
doorType string
floor int
}
func getBuilder() iBuilder {
return &normalBuilder{}
}
func (b *normalBuilder) setWindowType(windowType string) {
b.windowType = windowType
}
func (b *normalBuilder) setDoorType(doorType string) {
b.doorType = doorType
}
func (b *normalBuilder) setNumFloor(numFloor int) {
b.floor = numFloor
}
func (b *normalBuilder) getHouse() house {
return house{
doorType: b.doorType,
windowType: b.windowType,
floor: b.floor,
}
}