static void Main(string[] args) { BigMassiveRocket rocket = new BigMassiveRocket(); BigRedButton button = new BigRedButton(); button.RegisterHandler(rocket.Launch); string userInput = string.Empty; while (userInput != "q") { if (userInput == "push") { button.Push(); } userInput = Console.ReadLine(); } }
static void Main(string[] args) { BigMassiveRocket rocket = new BigMassiveRocket(); BigRedButton button = new BigRedButton(rocket.Launch); string userInput = string.Empty; while (userInput != "q") { if (userInput == "push") { Action pushMethod = button.Push; pushMethod(); } userInput = Console.ReadLine(); } }