Just noticed a small glitch in the attach() method - check_object will not
be called for the first object. Use this attach() / check_object()
implementation instead. The "var $class" instance variable of CTeeObject
can be omitted.
function attach(&$hObj) {
if (!$this->check_object($hObj))
return false;
$this->arObj[] =& $hObj;
return true;
}
// override this method in your derived class
// for additional class checks
function check_object(&$hObj)
{
// if this is the first object, simply accept it.
// for all successive objects make sure they have
// the same class (or at least derived from).
if (is_object($hObj))
return (!count($this->arObj) || is_a($hObj,
get_class($this->arObj[0])));
return false;
}
--
>O Ernest E. Vogelsinger
(\) ICQ #13394035
^ http://www.vogelsinger.at/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php