note 118066 deleted from language.oop5.visibility by cmb
| From: | cmb@php.net | Date: | Fri, 25 Nov 2016 23:46:27 +0000 |
| Subject: | note 118066 deleted from language.oop5.visibility by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-207694@lists.php.net to get a copy of this message | ||
Note Submitter: Anonymous
----
A useful extension to Example #2:
<?php
class Base
{
public function test() {
$this->testPublic();
self::testPublic();
$this->testProtected();
self::testProtected();
$this->testPrivate();
self::testPrivate();
}
public function testPublic() {
echo "Base::testPublic\n";
}
protected function testProtected() {
echo "Base::testProtected\n";
}
private function testPrivate() {
echo "Base::testPrivate\n";
}
}
class Ext extends Base
{
public function testPublic() {
echo "Ext::testPublic\n";
}
protected function testProtected() {
echo "Ext::testProtected\n";
}
private function testPrivate() {
echo "Ext::testPrivate\n";
}
}
$ext = new Ext();
$ext->test();
// gives:
// Ext::testPublic
// Ext::testProtected
// Base::testPrivate
?>