I have a class named TestMaze
. I have another class named DisplayHome
which has a method called gameOver()
:
public void gameOver()
{
Console.Write("GAME OVER!");
Console.Write("Play Again? Y/N");
if(char.ToLower(Convert.ToChar(Console.Read())=='y')
//Main()
else
Environment.Exit(1);
}
How can I call the Main method?
PS. they have the same namespace. I just need to know how can I call the Main method again.
You should have a Play() method inside your Main... and GameOver() should call Play() if user enters 'y'.