note 75280 added to language.oop5.decon
| From: | penartur at osu1 dot php dot net | Date: | Tue, 22 May 2007 08:19:37 +0000 |
| Subject: | note 75280 added to language.oop5.decon | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-126812@lists.php.net to get a copy of this message | ||
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...
----
Server IP: 195.54.192.44
Probable Submitter: 213.134.196.50
----
Manual Page -- http://www.php.net/manual/en/language.oop5.decon.php
Edit -- https://master.php.net/note/edit/75280
Del: integrated -- https://master.php.net/note/delete/75280/integrated
Del: useless -- https://master.php.net/note/delete/75280/useless
Del: bad code -- https://master.php.net/note/delete/75280/bad+code
Del: spam -- https://master.php.net/note/delete/75280/spam
Del: non-english -- https://master.php.net/note/delete/75280/non-english
Del: in docs -- https://master.php.net/note/delete/75280/in+docs
Del: other reasons-- https://master.php.net/note/delete/75280
Reject -- https://master.php.net/note/reject/75280
Search -- https://master.php.net/manage/user-notes.php