note 75280 deleted from language.oop5.decon by tularis

From: Date: Tue, 22 May 2007 08:35:28 +0000
Subject: note 75280 deleted from language.oop5.decon by tularis
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-126814@lists.php.net to get a copy of this message
Note Submitter: penartur ---- Looks like some bug with visibility, do not know, may be, this behaviour is evident for someone; not for me. So, the following example: <?php class ParentClass { private function __construct() { } public static function getChild() { return new ChildClass(); } } class ChildClass extends ParentClass { } ParentClass::getChild(); ?> will produce the following fatal error: "Fatal error: Call to private ParentClass::__construct() from context 'ParentClass' in ***.php on line 5" However, if we will change ParentClass::__construct's visibility to protected (or replace "new ChildClass()" to "new ParentClass()" in ParentClass::getChild()) - there would be no erros. PS: Please, forgive me my bad English...

« previous php.notes (#126814) next »