Content deleted Content added
→Java: add image |
|||
Line 166:
/// Implementation of Factory - Used to create objects.
/// </summary>
public class
{
public IPerson GetPerson(PersonType type)
Line 182:
}
</syntaxhighlight>
In the above code you can see the creation of one interface called <code>IPerson</code> and two implementations called <code>Villager</code> and <code>CityPerson</code>. Based on the type passed into the <code>
A factory method is just an addition to <code>
<syntaxhighlight lang="csharp">
|