in reply to Re: Factory Pattern for Class Heirarchy
in thread Factory Pattern for Class Heirarchy
The factory probably isn't going to be contained in the base class (though that certainly is a possibility). So the code above is fine if you just turn it into a method in one of your factory classes.
And depending on your solution, it may be a good idea to consider if you want the method to return the new object or the name of the new class.
One thing to remember is that you need to use D1;, use D2; etc so Perl will load the module and be able to find the new() method of the particular class. That means you still have to modify code when you add a new class (unless you script that too).
/J
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: RE: Re: Factory Pattern for Class Heirarchy
by dcorbin (Sexton) on Oct 08, 2000 at 23:45 UTC | |
by johannz (Hermit) on Oct 10, 2000 at 02:19 UTC | |
by merlyn (Sage) on Oct 10, 2000 at 02:27 UTC | |
by johannz (Hermit) on Oct 10, 2000 at 02:43 UTC |