static void Main(string[] args) { HeroFactory voin = new VoinFactory(); voin = new ElfFactory(); Hero heroVoin = new Hero(voin); heroVoin.Hit(); heroVoin.Run(); Console.ReadLine(); }
static void Main(string[] args) { ICharacterFactory factory; Character archer, warrior, wizard; //// Create Human Archer, Warrior, Wizard factory = new HumanFactory(); archer = factory.CreateArcher(); warrior = factory.CreateWarrior(); wizard = factory.CreateWizard(); //// Create Elf Archer, Warrior, Wizard factory = new ElfFactory(); archer = factory.CreateArcher(); warrior = factory.CreateWarrior(); wizard = factory.CreateWizard(); //// Create Orc Archer, Warrior, Wizard factory = new OrcFactory(); archer = factory.CreateArcher(); warrior = factory.CreateWarrior(); wizard = factory.CreateWizard(); }