static void Main(string[] args) { Console.WriteLine("***Abstract Factory Pattern Demo***\n"); //Making a wild dog through WildAnimalFactory IAnimalFactory wildAnimalFactory = new WildAnimalFactory(); IDog wildDog = wildAnimalFactory.GetDog(); wildDog.Speak(); wildDog.Action(); //Making a wild tiger through WildAnimalFactory ITiger wildTiger = wildAnimalFactory.GetTiger(); wildTiger.Speak(); wildTiger.Action(); Console.WriteLine("******************"); //Making a pet dog through PetAnimalFactory IAnimalFactory petAnimalFactory = new PetAnimalFactory(); IDog petDog = petAnimalFactory.GetDog(); petDog.Speak(); petDog.Action(); //Making a pet tiger through PetAnimalFactory ITiger petTiger = petAnimalFactory.GetTiger(); petTiger.Speak(); petTiger.Action(); Console.ReadLine(); }
static void Main() { Console.WriteLine("***Abstract Factory Pattern***\n"); IAnimalFactory wildAnimalFactory = new WildAnimalFactory(); IDog wilDog = wildAnimalFactory.GetDog(); wilDog.Speak(); wilDog.Action(); ITiger wildTiger = wildAnimalFactory.GetTiger(); wildTiger.Speak(); wildTiger.Action(); }