コード例 #1
0
        static void Main(string[] args)
        {
            ContinentFactory[] continentFactories = new ContinentFactory[]
            {
                new AfricaFactory(),
                new AmericaFactory()
            };

            Console.WriteLine(string.Join <ContinentFactory>($"{Environment.NewLine}{Environment.NewLine}", continentFactories));
        }
コード例 #2
0
 public AnimalWorld(ContinentFactory factory)
 {
     this.herbivore = factory.CreateHerbivore();
     this.carnivore = factory.CreateCarnivore();
 }
コード例 #3
0
 public Ecosystem(ContinentFactory factory)
 {
     _herbivore = factory.CreateHerbivore();
     _carnivore = factory.CreateCarnivore();
 }