Factory Method Pattern Code Review
Define the Product Interface and Handler Objects
Code Review
- Factory Method Pattern Code Review: Define the Factory Object
- Factory Method Pattern Code Review: Define the Product Interface and Handler Objects
- Factory Method Pattern Code Review: Use the Factory Method Pattern
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."); } } }
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."); } } }
Printer Friendly Version
Add to Favourites
DotNet Kicks
Digg
del.icio.us
Live Favourites
ma.gnolia
reddit
Slashdot
Technorati
Yahoo!