All pastes #459117 Raw Edit

Mine

public text v1 · immutable
#459117 ·published 2007-04-26 08:29 UTC
rendered paste body
Index: en/language/oop5/visibility.xml
===================================================================
RCS file: /repository/phpdoc/en/language/oop5/visibility.xml,v
retrieving revision 1.10
diff -u -r1.10 visibility.xml
--- en/language/oop5/visibility.xml     12 Aug 2006 17:24:36 -0000      1.10
+++ en/language/oop5/visibility.xml     26 Apr 2007 08:28:54 -0000
@@ -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>