Skip to content

Instantly share code, notes, and snippets.

@ssukhpinder
Created May 24, 2021 13:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ssukhpinder/25db87d201e1c1b785d049e09fd66417 to your computer and use it in GitHub Desktop.
Save ssukhpinder/25db87d201e1c1b785d049e09fd66417 to your computer and use it in GitHub Desktop.
static void Main(string[] args)
{
List<string> accNames = new List<string> { "B1-456", "B1-987", "B2-222" };
for (int i = 0; i < accNames.Count; i++)
{
AccountTypeFactory anAbstractFactory = AccountFactoryProvider.GetAccountTypeFactory(accNames[i]);
if (anAbstractFactory == null)
{
Console.WriteLine("Invalid " + (accNames[i]));
}
else
{
ISavingAccount savingAccount = anAbstractFactory.SavingAccountFactory("Hello saving");
ICurrentAccount currentAccount = anAbstractFactory.CurrentAccountFactory("Hello Current");
}
}
Console.ReadLine();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment