Created
November 8, 2021 17:13
-
-
Save cch12313/8b67ede6c28c54761f319c74928422ec to your computer and use it in GitHub Desktop.
This file contains hidden or 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 enum RacingType | |
{ | |
Default = 0, | |
Toyote = 1, | |
Bens = 2, | |
Tezla = 3, | |
Blanket = 4, | |
Chair = 5, | |
Gororo = 6, | |
} | |
public class RacingFactory | |
{ | |
public IRacing Create(RacingType racingType) | |
{ | |
IRacing racing; | |
switch (racingType) | |
{ | |
case RacingType.Toyote: | |
racing = new Toyote(); | |
break; | |
case RacingType.Bens: | |
racing = new Bens(); | |
break; | |
case RacingType.Tezla: | |
racing = new Tezla(); | |
break; | |
case RacingType.Blanket: | |
racing = new Blanket(); | |
break; | |
case RacingType.Chair: | |
racing = new Chair(); | |
break; | |
case RacingType.Gororo: | |
racing = new Gororo(); | |
break; | |
default: | |
throw new NotImplementedException(); | |
} | |
return racing; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment