For Programmers: Free Programming Magazines  


Home > Archive > PHP Documentation > April 2007 > cvs: phpdoc /en/language/oop5 visibility.xml









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author cvs: phpdoc /en/language/oop5 visibility.xml
Etienne Kneuss

2007-04-27, 6:59 pm

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/phpdo...1&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>
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com