Factory Method Pattern Code Review

Define the Product Interface and Handler Objects

Code Review

Code Walkthrough

Define the Product class containing the IProduct interface and inherited Product subclasses.

class Product { public interface IProduct { String ShipFrom(); }
internal class ProductA : IProduct { public String ShipFrom() { return (" from South Africa."); } }
internal class ProductB : IProduct { public String ShipFrom() { return (" from Spain."); } }
internal class ProductC : IProduct { public String ShipFrom() { return (" not available."); } } }