note 30935 added to language.oop.constructor

From: Date: Thu, 03 Apr 2003 18:39:54 +0000
Subject: note 30935 added to language.oop.constructor
Groups: php.notes 
Request: Send a blank email to php-notes+get-46179@lists.php.net to get a copy of this message
As far as I understand php has a strange way of handeling over loaded contructors - only the last defined will be used. e.g. class Cl { function Cl($a, $b) { echo("B "); } function Cl($a) { echo("A "); } } new Cl(1); new Cl(1, 2); // Out puts: // B B // And at the contrary: class Cl { function Cl($a, $b) { echo("B "); } function Cl($a) { echo("A "); } } new Cl(1); new Cl(1, 2); // Out puts: // Warning: Missing argument 2 for cl() ... -- http://www.php.net/manual/en/language.oop.constructor.php http://master.php.net/manage/user-notes.php?action=edit+30935 http://master.php.net/manage/user-notes.php?action=delete+30935 http://master.php.net/manage/user-notes.php?action=reject+30935

« previous php.notes (#46179) next »