Created
November 6, 2016 12:43
-
-
Save snippe/48df79a4120fca678a1671b014d9b0e6 to your computer and use it in GitHub Desktop.
Parameterized Factory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class PersonFactory | |
{ | |
public Person GetPerson(int id) | |
{ | |
if (id > 1000) | |
{ | |
return new Employee(); | |
} | |
else | |
{ | |
return new Customer(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment