the standard Factory pattern is to have a method that creates the object
rather tan using the new operator. but what happens if you waat to add a new
object creation type to the factory?
the case for this is when you create a class that inherits from the classes
the factory generates. say you have a class Widget, and a factory method
Widget.CreateWidget(). now you create a new class MyWidget that inherits
from Widget. simple enough, but how do you get the Factory to create a
MyWidget, rather than a Widget.
this is what the abstract factory pattern is for, a way to replace the
factory code so that when a class calls Widget.CreateWidget() it return an
instance of MyWidget.
-- bruce (sqlwork.com)
"max" <ma*@discussions.microsoft.com> wrote in message
news:26**********************************@microsof t.com...
Hello,
I analyze this design pattern for a long time but I do not understand how
this pattern work and what the purpose is? (I looked a this site
http://www.dofactory.com/Patterns/PatternAbstract.aspx).
Could anybody try to explain me in his own words how this pattern work and
what the purpose is?
thanks in advance
max
PS: Generally I do not understand why they use (also in Adapter) for
example
AbstractFactory factory1 = new ConcreteFactory1(); - Means they define a
object from an abstract class and create in this object a object from a
concrete class. What is the sense of that? :(