static void Main(string[] args) { var belarus = new BelarusFactory(); var world = new AnimalWorld(belarus); world.RunFoodChain(); }
static void Main(string[] args) { string continent = ""; if (args.Length >= 1) { continent = args[0]; //properties of the project >> Debug >> Aplication Arguments } //here we can see that the class (AnimalWorld) has private constructor IContinentFactory myContinent1 = AnimalWorld.CreateContinent(continent); //factory ICarnivore myCarnivore1 = myContinent1.CreateCarnivore(); //factory IHebivore myHarbivore1 = myContinent1.CreateHerbivore(); myCarnivore1.Hunt(); myHarbivore1.Graze(); Console.WriteLine(myCarnivore1.GetType().FullName); //Console.WriteLine("Choose continent"); //string continent = "america"; //Console.WriteLine("Choose continent"); //string continent2 = Console.ReadLine(); //var myContinent2 = AnimalWorld.CreateContinent(continent2); //var myC2 = myContinent2.CreateCarnivore(); //myC2.Hunt(); Console.ReadKey(); }
static void Main() { /* * Structural */ StructuralAbstractFactory factory1 = new ConcreteFactory1(); Client client1 = new Client(factory1); client1.Run(); StructuralAbstractFactory factory2 = new ConcreteFactory2(); Client client2 = new Client(factory2); client2.Run(); /* * Real World */ AfricaFactory africa = new AfricaFactory(); AnimalWorld world = new AnimalWorld(africa); world.RunFoodChain(); RealWorldAbstractFactory america = new AmericaFactory(); world = new AnimalWorld(america); world.RunFoodChain(); }
static void Main(string[] args) { AnimalWorld AfricaWorld = new AnimalWorld(); AfricaWorld.AnimalWorldFactory = new Africa(); Herbivore herbivore = AfricaWorld.CreatHerbivores(); Carnivore carnivore = AfricaWorld.CreatCarnivores(); }
static void Main(string[] args) { ContinentFactory asia = new AsiaFactory(); AnimalWorld world = new AnimalWorld(asia); world.RunFoodChain(); ContinentFactory america = new AmericaFactory(); world = new AnimalWorld(america); world.RunFoodChain(); }
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(); }
/// Entry point into console application. 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(); int unOps = 5; int preIncrement; int preDecrement; int postIncrement; int postDecrement; int positive; int negative; bool temp; preIncrement = ++unOps; Console.WriteLine("pre-Increment: {0}", preIncrement); preDecrement = --unOps; Console.WriteLine("pre-Decrement: {0}", preDecrement); postDecrement = unOps--; Console.WriteLine("Post-Decrement: {0}", postDecrement); postIncrement = unOps++; Console.WriteLine("Post-Increment: {0}", postIncrement); Console.WriteLine("Final Value of unOps is: {0}", unOps); positive = +postIncrement; Console.WriteLine("Positive: {0}", positive); negative = -postIncrement; Console.WriteLine("Negative: {0}", negative); temp = false; temp = !temp; Console.WriteLine("Logical Not: {0}", temp); }
static void Main(string[] args) { var africa = new AnimalWorld <Africa>(); africa.RunFoodChain(); var america = new AnimalWorld <America>(); america.RunFoodChain(); Console.ReadKey(); }
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(); }
static void Main(string[] args) { AnimalWorld.Herbivores.AddLast(new Gnu()); AnimalWorld.Herbivores.AddFirst(new Bison()); AnimalWorld.Carnivores.AddLast(new Lion()); AnimalWorld.Carnivores.AddFirst(new Wolf()); AnimalWorld.MealHerbivore(); foreach (var item in AnimalWorld.Herbivores) { Console.WriteLine(item.Height); } AnimalWorld.MealCarnivore(); }
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(); }
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(); }
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(); }
/// <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) { 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(); }
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(); }
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 */ }
/// <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) { ContinentFactory afrFactory = new AfricanFactory(); ContinentFactory americanFactory = new AmericanFactory(); AnimalWorld animalWorld = new AnimalWorld(afrFactory); animalWorld.FoodChain(); AnimalWorld animal2World = new AnimalWorld(americanFactory); animal2World.FoodChain(); Console.ReadKey(); }