Posted by Toby A Inkster on 04/12/07 23:27
amygdala wrote:
> I'm a little confused about the 'factory design pattern' though. Let me see
> if I understand this correctly. Does the factory design pattern in this case
> refer to the fact that you have different interfaces in one Class (in this
> case class User) to create the object, depending on the purpose it serves.
Yep, precisely. You create a static method to produce an object which
would normally go further than the plain constructor function in terms of
setting object properties.
On some occasions you may even want to make the main constructor method
for the class private instead of public to force all objects to be created
via the factory.
--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact
Geek of ~ HTML/SQL/Perl/PHP/Python*/Apache/Linux
* = I'm getting there!
Navigation:
[Reply to this message]
|