public static void Main()
Console.WriteLine("Hello World");
var client = new Client();
client.Do(new PlasticFactory());
client.Do(new WoodenFactory());
public void Do(IFactory factory){
public interface IFactory{
public class PlasticFactory : IFactory{
public Chair CreateChair(){
return new PlasticChair();
public Table CreateTable(){
return new PlasticTable();
public class WoodenFactory : IFactory{
public Chair CreateChair(){
return new WoodenChair();
public Table CreateTable(){
return new WoodenTable();
public interface IProduct {
public abstract class Chair : IProduct{
public abstract class Table : IProduct{
public class PlasticChair : Chair {
Console.WriteLine("PlasticChair is created!");
public class PlasticTable : Table {
Console.WriteLine("PlasticTable is created!");
public class WoodenChair : Chair {
Console.WriteLine("WoodenChair is created!");
public class WoodenTable : Table {
Console.WriteLine("WoodenTable is created!");