Re: Constructors as factory methods
| From: | Chuck Hagenbuch | Date: | Thu, 16 Aug 2001 14:12:07 +0000 |
| Subject: | Re: Constructors as factory methods | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-1567@lists.php.net to get a copy of this message | ||
Quoting Mika Tuupola <tuupola@appelsiini.net>:
> $c = new Car("Lada")
You can get this to work, but you need to rely on quirks of the engine that
aren't guaranteed to be preserved.
> c= new Car::Factory("Lada")
This, however, will always work, and you only need to type a few more
characters. It's also clear that it's a factory method, instead of just a
parameterized constructor.
-chuck
--
Charles Hagenbuch, <chuck@horde.org>
Some fallen angels have their good reasons.