How to use state pattern correctly?

后端 未结 9 695
既然无缘
既然无缘 2021-01-29 21:54

I\'ve encountered a few implementations of state pattern in my programming experience, and done a few. I\'ve seen them used in various scenarios (mostly UI and parsing). The tro

9条回答
  •  一生所求
    2021-01-29 22:17

    have a look at Finite State Machine. Almost every mature language has own good examples. Since you haven't specified your preferred language, I'll give you C++ example: Boost FSM library. Most probably it's much more complicated than you need, but it can give you some design hints for sure

提交回复
热议问题