Factory Method Pattern Code Review

Use the Factory Method Pattern

Code Review

Code Walkthrough

The Program class creates an instance of the Factory class, and creates instance of IProduct interface.

class Program { static void Main(string[] args) { Factory factory = new Factory(); Product.IProduct product;
for (Int32 i = 1; i <= 12; i++) { product = factory.FactoryMethod(i); Console.WriteLine(String.Format("Product {0}", product.ShipFrom())); }
Console.Read(); } }

During the iteration process a specific Product subclass is created by the FactoryMethod() method and relevant ShipFrom() method invoked on the subclass.