note 110164 added to language.oop5.visibility
| From: | Cyril | Date: | Tue, 25 Sep 2012 16:28:43 +0000 |
| Subject: | note 110164 added to language.oop5.visibility | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-191014@lists.php.net to get a copy of this message | ||
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.
----
Server IP: 69.147.83.199
Probable Submitter: 94.228.180.154
----
Manual Page -- http://www.php.net/manual/en/language.oop5.visibility.php
Edit -- https://master.php.net/note/edit/110164
Del: integrated -- https://master.php.net/note/delete/110164/integrated
Del: useless -- https://master.php.net/note/delete/110164/useless
Del: bad code -- https://master.php.net/note/delete/110164/bad+code
Del: spam -- https://master.php.net/note/delete/110164/spam
Del: non-english -- https://master.php.net/note/delete/110164/non-english
Del: in docs -- https://master.php.net/note/delete/110164/in+docs
Del: other reasons-- https://master.php.net/note/delete/110164
Reject -- https://master.php.net/note/reject/110164
Search -- https://master.php.net/manage/user-notes.php