You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
689 B

2 years ago
using FactoryMethod.Creators;
using FactoryMethod.Products;
using System;
2 years ago
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FactoryMethod
{
internal class Client
{
public void Main()
{
Console.WriteLine("App: Launched with the ConcreateCreator1");
ClinetCode(new ConcreateCreator1());
Console.WriteLine("---");
Console.WriteLine("App: Launched with the ConcreateCreator2");
ClinetCode(new ConcreateCreator2());
}
private void ClinetCode(Creator creator)
{
Console.WriteLine($"Client: I'm not aware of the creator's class, " +
$"but it still works. {creator.SomeOperation()}");
}
}
}