static void Main(string[] args) { ContinentFactory myContinentFactory = new AfricaFactory(); AnimalWorld myAnimalWorld = new AnimalWorld(myContinentFactory); myAnimalWorld.RunFoodChain(); myContinentFactory = new AmericaFactory(); myAnimalWorld = new AnimalWorld(myContinentFactory); myAnimalWorld.RunFoodChain(); }
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(); }
public static void Main() { ContinentFactory africa = new AfricaFactory(); AnimalWorld world = new AnimalWorld(africa); world.RunFoodChain(); ContinentFactory america = new AmericaFactory(); world = new AnimalWorld(america); world.RunFoodChain(); Console.ReadKey(); }
static void Main(string[] args) { ContinentFactory africa = new AfricaFactory(); AnimalWorld world = new AnimalWorld(africa); world.RunFood(); ContinentFactory america = new AmericaFactory(); world = new AnimalWorld(america); world.RunFood(); Console.ReadKey(); }
public void Main() { // Create and run the African animal world IContinentFactory africa = new AfricaFactory(); var world = new AnimalWorld(africa); world.RunFoodChain(); // Create and run the American animal world IContinentFactory america = new AmericaFactory(); world = new AnimalWorld(america); world.RunFoodChain(); }
public static IContinentFactory CreateContinent(string continet) { IContinentFactory cf; if (continet.ToLower().Trim() == "america") { cf = new AmericaFactory(); } else { cf = new AfricaFactory(); } return(cf); }
static void Main(string[] args) { 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(); 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) { Console.WriteLine("Animales concretos de africa"); IContinentFactory africa = new AfricaFactory(); AnimalWorld clienteAfrica = new AnimalWorld(africa); clienteAfrica.RunFoodChain(); Console.WriteLine("Animales concretos de america"); IContinentFactory america = new AmericaFactory(); AnimalWorld clienteAmerica = new AnimalWorld(america); clienteAmerica.RunFoodChain(); Console.ReadKey(); }
static void Main(string[] args) { // Create and run the African animal world ContinentFactory africa = new AfricaFactory(); AnimalWorldClient world = new AnimalWorldClient(africa); world.RunFoodChain(); // Create and run the American animal world ContinentFactory america = new AmericaFactory(); world = new AnimalWorldClient(america); world.RunFoodChain(); // Wait for user input Console.Read(); }
public static void Run() { Console.WriteLine("This real-world code demonstrates the creation of different animal worlds for a computer game using different factories. Although the animals created by the Continent factories are different, the interactions among the animals remain the same."); ContinentFactory africa = new AfricaFactory(); AnimalWorld world = new AnimalWorld(africa); world.RunFoodChain(); ContinentFactory america = new AmericaFactory(); world = new AnimalWorld(america); world.RunFoodChain(); /* * Lion eats Wildebeest * Wolf eats Bison */ }