static void Main(string[] args) { ContinentFactory africa = new AfricaFactory(); AnimalWorld world = new AnimalWorld(africa); world.RunFoodChain(); ContinentFactory america = new AmericaFactory(); world = new AnimalWorld(america); world.RunFoodChain(); Console.ReadKey(); }
/// <summary> /// Entry point into console application. /// </summary> public static void Main() { // Create and run the African animal world ContinentFactory africa = new AfricaFactory(); AnimalWorld world = new AnimalWorld(africa); world.RunFoodChain(); // Create and run the American animal world ContinentFactory america = new AmericaFactory(); world = new AnimalWorld(america); world.RunFoodChain(); // Wait for user input Console.ReadKey(); }
static void Main(string[] args) { AnimalWorld_Client world = null; IContinentFactory continent = null; string result = null; continent = new AmericaFactory(); world = new AnimalWorld_Client(continent); result = world.RunFoodChain(); Console.WriteLine(result); // Wolf eats Bison continent = new AfricaFactory(); world = new AnimalWorld_Client(continent); result = world.RunFoodChain(); Console.WriteLine(result); // Lion eats Wildebeest Console.ReadLine(); }