At 15:49 22/5/2001, Kristian Köhntopp wrote:
>Zeev Suraski wrote:
> > It's good that this question was asked, but really, be prepared to the fact
> > that 'no' can also be an answer.
>
>Then let me rephrase the question: What is the recommended
>way to signal error conditions from the inside of an object
>constructor?

Have a predefined error property that can be checked in case startup fails:

function foo_class()
{
         $this->ok = false;
         ...initialize...
         $this->ok = true;
}

$obj = new foo_class;
if (!$obj->ok) {
         ...
}

That should always work.

Zeev


--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to