Re: coding recommendations
| From: | alexander dot merz at t-online dot de | Date: | Sun, 26 Jan 2003 04:30:52 +0000 |
| Subject: | Re: coding recommendations | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-12754@lists.php.net to get a copy of this message | ||
Krystof Slaby schrieb:
> why is recommended to use "$this->PEAR()" instead of
> "parent::PEAR()" in
> constructor of "class Foo extends PEAR" ?
You should call the parent constructor to set some pear-related
*instance* variables if necessary - you can not set them,
if you have no instance of a class :-)
> why there's no recommendation for constructor to return
> error code (pear error)
> based on successfullness of initialization ?
Because return "raiseError(...);" in the constructor is senseless.
But it is a really good idea to call "raiseError(...);" just as
method/function in case of an error - the class user has still the
chance to get the information - or not, if the error mode still set to
PEAR_ERROR_RETURN.