colder Fri Apr 27 14:39:54 2007 UTC
Modified files: /phpdoc/en/language/oop5 visibility.xml Log: Fix #41090 (overriding a private method) in an example http://cvs.php.net/viewvc.cgi/phpdoc/en/language/oop5/visibility.xml?r1=1.10&r2=1.11&diff_format=u Index: phpdoc/en/language/oop5/visibility.xml diff -u phpdoc/en/language/oop5/visibility.xml:1.10 phpdoc/en/language/oop5/visibility.xml:1.11 --- phpdoc/en/language/oop5/visibility.xml:1.10 Sat Aug 12 17:24:36 2006 +++ phpdoc/en/language/oop5/visibility.xml Fri Apr 27 14:39:54 2007 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.10 $ --> +<!-- $Revision: 1.11 $ --> <sect1 id="language.oop5.visibility"> <title>Visibility</title> <para> @@ -142,6 +142,37 @@ $myclass2 = new MyClass2; $myclass2->MyPublic(); // Works $myclass2->Foo2(); // Public and Protected work, not Private + +class Bar +{ + public function test() { + $this->testPrivate(); + $this->testPublic(); + } + + public function testPublic() { + echo "Bar::testPublic\n"; + } + + private function testPrivate() { + echo "Bar::testPrivate\n"; + } +} + +class Foo extends Bar +{ + public function testPublic() { + echo "Foo::testPublic\n"; + } + + private function testPrivate() { + echo "Foo::testPrivate\n"; + } +} + +$myFoo = new foo(); +$myFoo->test(); // Bar::testPrivate + // Foo::testPublic ?> ]]> </programlisting>