protected override Person CreatePerson(string personTypeString, string personNameString, Location personLocation) { Person person = null; switch (personTypeString) { case "merchant": person = new Merchant(personNameString, personLocation); break; default: return base.CreatePerson(personTypeString, personNameString, personLocation); } return person; }
protected override Person CreatePerson(string personTypeString, string personNameString, Location personLocation) { Person person = null; switch (personTypeString) { case "merchant": person = new Merchant(personNameString, personLocation); break; case "shopkeeper": person = new Shopkeeper(personNameString, personLocation); break; case "traveller": person = new Traveller(personNameString, personLocation); break; default: break; } return person; }
protected override Person CreatePerson(string personTypeString, string personNameString, Location personLocation) { if (personTypeString != "merchant") { return base.CreatePerson(personTypeString, personNameString, personLocation); } Person person = null; person = new Merchant(personNameString, personLocation); return person; }