I'm making a game menu using a composite pattern. I want to achieve a tree structure game menu, where some leaves are pushing new state on the top of my state machine and another in options should show for example slider to change the volume without making new state and another (exit) should close the game by running sfml method.
Can someone give me a better idea than returning string or enum by operation() method to menu state to run expected action by using value in if/switch?