How to implement a finite state machine ( FSM )?

For example, you could fill these with print statements, or you could invoke some method on the light object that got passed in, such as light->increaseGlow (). Let’s also create definitions for all of the toggle and getInstance methods, to make things clearer:
For More Information Please Refer:

You May Also Like to Read: