note 110891 added to language.oop5.visibility
| From: | andrei at leapingbytes dot net | Date: | Thu, 20 Dec 2012 09:50:59 +0000 |
| Subject: | note 110891 added to language.oop5.visibility | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-192610@lists.php.net to get a copy of this message | ||
Interestingly enough, PHP does very reasonable job in regards to interaction between classes and
plain functions (even ones defined in the same file as the class)
<?php
class Test {
private function foo() {
echo "Foo" . PHP_EOL;
}
protected function bar() {
echo "bar" . PHP_EOL;
}
static function foobar($test) {
$test->bar(); // works
$test->foo(); // works
}
}
function simple_function() {
$test = new Test();
$test->bar(); // does not work
$test->foo(); // does not work
Test::foobar($test); // works
}
simple_function();
----
Server IP: 69.147.83.199
Probable Submitter: 174.127.225.93
----
Manual Page -- http://php.net/manual/en/language.oop5.visibility.php
Edit -- https://master.php.net/note/edit/110891
Del: integrated -- https://master.php.net/note/delete/110891/integrated
Del: useless -- https://master.php.net/note/delete/110891/useless
Del: bad code -- https://master.php.net/note/delete/110891/bad+code
Del: spam -- https://master.php.net/note/delete/110891/spam
Del: non-english -- https://master.php.net/note/delete/110891/non-english
Del: in docs -- https://master.php.net/note/delete/110891/in+docs
Del: other reasons-- https://master.php.net/note/delete/110891
Reject -- https://master.php.net/note/reject/110891
Search -- https://master.php.net/manage/user-notes.php