n00bie
Новичок
Проблема с наследованием класса PHP 5
Два простых класса.
Первый -
и второй -
При попытке использования выдаёт
Fatal error: Class ObjectSet cannot extend from interface Iterator
Почему?
Два простых класса.
Первый -
PHP:
class Iterator
{
var $objects = array();
var $pointer;
var $eof;
function Iterator()
{
$this->pointer = 0;
}
function add($object)
{
$this->objects[] = &$object;
}
function current()
{
return $this->objects[$this->pointer];
}
function next()
{
if (!$this->eof) {
$this->pointer++;
if ($this->pointer == $this->count()) {
$this->eof = true;
}
}
}
function reset()
{
$this->pointer = ($this->count()>0) ? 1 : 0;
$this->eof = false;
}
function count()
{
return count($this->objects);
}
}
PHP:
class ObjectSet extends Iterator
{
function toArray()
{
return $this->objects;
}
}
?>
Fatal error: Class ObjectSet cannot extend from interface Iterator
Почему?
