Posted by www.douglassdavis.com on 09/20/05 07:10
Marcin Dobrucki wrote:
> Oli Filth wrote:
> > Marcin Dobrucki said the following on 16/09/2005 13:37:
>
> > What? How does that help?
> > If initialize() "fails" then the constructor has still "failed"...
>
> Close, but there are some benefits:
>
> "initialize" can do some gracious exist upon failure, still allowing
> you to create an object (albeit sans whatever the initalization was
> supposed to do, like values from DB or something). This is somewhat
> useful in avoiding getting the "method called on a non-object" errors.
>
With all due respect, i could do the same in the costructor. it's just
a matter of copy and paste.
[Back to original message]
|