public abstract void Eat(Herbivore h);
public override void Eat(Herbivore h) { // Eat Bison Console.WriteLine(this.GetType().Name + " eats " + h.GetType().Name); }
// Constructor public AnimalWorld(ContinentFactory factory) { _carnivore = factory.CreateCarnivore(); _herbivore = factory.CreateHerbivore(); }
public override void Eat(Herbivore a) { // Eat elephant Console.WriteLine(this.GetType().Name + " eats " + a.GetType().Name); }