// Constructor public AnimalWorld(ContinentFactory factory) { carnivore = factory.CreateCarnivore(); herbivore = factory.CreateHerbivore(); }
public override void Eat(Herbivore h) { // Eat Bison Console.WriteLine($"{GetType().Name} eats {h.GetType().Name}"); }
public override void Eat(Herbivore h) { // eat wildbeast Console.WriteLine(this.GetType().Name + " eats " + h.GetType().Name); }
public abstract void Eat(Herbivore h);
// Constructor public AnimalWorld(RealWorldAbstractFactory abstractFactory) { _carnivore = abstractFactory.CreateCarnivore(); _herbivore = abstractFactory.CreateHerbivore(); }