Created
May 24, 2021 06:31
-
-
Save ssukhpinder/83bf043816237f0ce5a7f57aee4e2aa3 to your computer and use it in GitHub Desktop.
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 AccountFactory : IAccountFactory | |
{ | |
public AccoutType GetAccoutType(string accountName) | |
{ | |
if (accountName.Equals("SAVINGS", StringComparison.OrdinalIgnoreCase)) | |
{ | |
return new SavingsAccount(); | |
} | |
else if (accountName.Equals("CURRENT", StringComparison.OrdinalIgnoreCase)) | |
{ | |
return new CurrentAccount(); | |
} | |
else | |
{ | |
throw new ArgumentException("Invalid account name"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment