Merge pull request #2 from shade/master
Use the State interface as apparent type for variable declaration
This commit is contained in:
commit
142591bb2f
@ -40,16 +40,17 @@ func (s *StopState) executeState(c *Context) {
|
|||||||
|
|
||||||
func StateDemo() {
|
func StateDemo() {
|
||||||
context := &Context{}
|
context := &Context{}
|
||||||
|
var state State
|
||||||
|
|
||||||
startState := &StartState{}
|
state = &StartState{}
|
||||||
startState.executeState(context)
|
state.executeState(context)
|
||||||
fmt.Println("state: ", context)
|
fmt.Println("state: ", context)
|
||||||
|
|
||||||
inprState := &InprogressState{}
|
state = &InprogressState{}
|
||||||
inprState.executeState(context)
|
state.executeState(context)
|
||||||
fmt.Println("state: ", context)
|
fmt.Println("state: ", context)
|
||||||
|
|
||||||
stopState := &StopState{}
|
state = &StopState{}
|
||||||
stopState.executeState(context)
|
state.executeState(context)
|
||||||
fmt.Println("state: ", context)
|
fmt.Println("state: ", context)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user