You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think, there is no constructor. (or misunderstand I something?)
I tried to extend 'SplDoublyLinkedList' in an own class and got the unexpected fatal error (see comment in code)
<?php
class Liste extends SplDoublyLinkedList
{
public function __construct() {
parent::__construct(); //<b>Fatal error</b>: Uncaught Error: Cannot call constructor in [...][...]:6
$this->push('klaus');
}
public function liste() {
$this->push('herbert');
}
}
$hallo = new Liste();
$hallo->push('padina');
$hallo->push('doof');
$hallo->liste();
foreach($hallo as $key=>$item) {
echo($key.' => '.$item."\n");
The text was updated successfully, but these errors were encountered:
nikic
changed the title
_--Construct-method not public
SplDoublyLinkedList::__construct() does not exist
May 29, 2021
From manual page: https://php.net/class.spldoublylinkedlist
The documentation describe a constructor.
https://www.php.net/manual/de/spldoublylinkedlist.construct.php
https://www.php.net/manual/en/spldoublylinkedlist.construct.php
I think, there is no constructor. (or misunderstand I something?)
I tried to extend 'SplDoublyLinkedList' in an own class and got the unexpected fatal error (see comment in code)
The text was updated successfully, but these errors were encountered: