Factory is used when the implementation of the class is unknown until run time. You usually have an interface, then multiple classes that implement the interface. Here is a practical example I remember from school.Here is the factory code. Now in you application, you can determine what kind of sort utility you want to use at run time...
“Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.” - Rich Cook
posted 13 years ago
Well if I understood you correctly. Factory is used for instance when an instance is created via relfection?
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad: