note 61562 added to language.oop5.visibility

From: Date: Tue, 07 Feb 2006 01:50:34 +0000
Subject: note 61562 added to language.oop5.visibility
Groups: php.notes 
Request: Send a blank email to php-notes+get-103147@lists.php.net to get a copy of this message
Note that you cannot change visibility in a child defined in the parent: class A { public function f() {} } class B extends A { private function f() {} } Produces Fatal error: Access level to B::f() must be public (as in class A) in ... jfk, visibility != security. Visibility prevents programmers from doing dumb things like: class A { private function __construct() {} final public static &factory() { return new A(); } } $x = new A(); The use of "protected" as an identifier is unfortunate tradition as it really means "only me and my decedents" (and in the odd case of PHP my ancestors too). ---- Server IP: 64.71.164.2 Probable Submitter: 68.7.70.16 ---- Manual Page -- http://www.php.net/manual/en/language.oop5.visibility.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+61562 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+61562&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+61562&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+61562&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+61562&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+61562&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+61562&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+61562&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+61562&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#103147) next »