note 103054 added to splpriorityqueue.construct

From: Date: Tue, 22 Mar 2011 20:19:15 +0000
Subject: note 103054 added to splpriorityqueue.construct
Groups: php.notes 
Request: Send a blank email to php-notes+get-178110@lists.php.net to get a copy of this message
I was trying to extend SplPriorityQueue like this: <?php class AdjustablePriorityQueue extends SplPriorityQueue { protected $direction='desc';//queue is ordered highest to lowest priority, direction is changeable ONLY on __construct() function __construct($direction='desc'){ parent::__construct(); //Fatal error: Cannot call constructor $this->direction=($direction=='asc') ? 'asc': 'desc'; } function compare($priority1,$priority2){ if($this->direction=='asc') return parent::compare($priority2, $priority1); return parent::compare($priority1,$priority2); } } ?> calling parent::__construct() gives a fatal error " Cannot call constructor". If I leave out that call, everything works fine. This suggests that SplPriorityQueue does not actually have a __construct() method. ---- Server IP: 216.235.13.26 Probable Submitter: 132.246.244.119 ---- Manual Page -- http://www.php.net/manual/en/splpriorityqueue.construct.php Edit -- https://master.php.net/note/edit/103054 Del: integrated -- https://master.php.net/note/delete/103054/integrated Del: useless -- https://master.php.net/note/delete/103054/useless Del: bad code -- https://master.php.net/note/delete/103054/bad+code Del: spam -- https://master.php.net/note/delete/103054/spam Del: non-english -- https://master.php.net/note/delete/103054/non-english Del: in docs -- https://master.php.net/note/delete/103054/in+docs Del: other reasons-- https://master.php.net/note/delete/103054 Reject -- https://master.php.net/note/reject/103054 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#178110) next »