Exit(?) a class

I’ve created a short game where the main class file, MainGame, creates an instance of the actual game, ActualGame. MainGame displays the start screen complete with a “Play game” button which creates an instance of ActualGame. After playing this game, I want the user to be able to end the game and go back to the MainGame screen. I am not sure how to somehow flag to the main class that I am done with the actual game.

I thought about including a loop in MainGame that checks a Boolean variable isPlaying that can be changed to false when the player wants to go back to the main menu… There has to be a better way though… Anyone?