note 110164 deleted from language.oop5.visibility by aharvey

From: Date: Wed, 26 Sep 2012 00:35:54 +0000
Subject: note 110164 deleted from language.oop5.visibility by aharvey
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-191022@lists.php.net to get a copy of this message
Note Submitter: Cyril ---- Protected visibily can have some strange results. This code works : <?php class foo { public function bar(){ $f = new foo(); $f->baz(); } protected function baz(){ echo 'hello world'; } } $foo = new foo(); $foo->bar(); // display hello world ?> protected function baz should not be accessible from a new instance. $f->baz() is a public access. but in the context of the same class, it will be. Hope this will help you.

« previous php.notes (#191022) next »