note 61562 deleted from language.oop5.visibility by danbrown

From: Date: Fri, 21 Nov 2008 20:18:55 +0000
Subject: note 61562 deleted from language.oop5.visibility by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-146807@lists.php.net to get a copy of this message
Note Submitter: c3 at epetersen dot org ---- 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).

« previous php.notes (#146807) next »