Re: Another patch

From: Date: Fri, 23 Jul 2004 14:12:39 +0000
Subject: Re: Another patch
References: 1  Groups: php.doc 
Request: Send a blank email to phpdoc+get-969362113@lists.php.net to get a copy of this message
I have granted Karma to you on phpdoc. Goba
Sorry about the number of mails with patches, I just don't like the idea of things being sat around on my hard disk :P This one documents the final keyword for PHP 5. Jon ------------------------------------------------------------------------ Index: en/language/oop5/final.xml =================================================================== RCS file: /repository/phpdoc/en/language/oop5/final.xml,v retrieving revision 1.1 diff -u -r1.1 final.xml --- en/language/oop5/final.xml 11 Jul 2004 12:33:25 -0000 1.1 +++ en/language/oop5/final.xml 23 Jul 2004 11:48:24 -0000 @@ -3,9 +3,35 @@ <sect1 id="language.oop5.final"> <title>Final Keyword</title> <para> - . + PHP 5 introduces the final keyword, which prevents child classes from + overriding a method or variable by prefixing the definition with final. </para> + + <example> + <title>Abstract class example</title>
+    <programlisting role="php">
+<![CDATA[ +<?php +class BaseClass { + public function test() {
+       echo "BaseClass::test() called\n";
+ } + + final public function moreTesting() {
+       echo "BaseClass::moreTesting() called\n";
+ } +} +class ChildClass extends BaseClass { + public function moreTesting() {
+       echo "ChildClass::moreTesting() called\n";
+ } +} +// Results in Fatal error: Cannot override final method BaseClass::moreTesting() +?> +]]> + </programlisting> + </example> </sect1>


« previous php.doc (#969362113) next »