cvs: phpdoc /en/language/oop5 interfaces.xml

From: Date: Mon, 11 Aug 2008 22:16:24 +0000
Subject: cvs: phpdoc /en/language/oop5 interfaces.xml
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-2017@lists.php.net to get a copy of this message
kalle Mon Aug 11 22:16:24 2008 UTC Modified files: /phpdoc/en/language/oop5 interfaces.xml Log: Document that interfaces can be extended + usage example http://cvs.php.net/viewvc.cgi/phpdoc/en/language/oop5/interfaces.xml?r1=1.10&r2=1.11&diff_format=u Index: phpdoc/en/language/oop5/interfaces.xml diff -u phpdoc/en/language/oop5/interfaces.xml:1.10 phpdoc/en/language/oop5/interfaces.xml:1.11 --- phpdoc/en/language/oop5/interfaces.xml:1.10 Mon Jun 25 17:59:35 2007 +++ phpdoc/en/language/oop5/interfaces.xml Mon Aug 11 22:16:23 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.10 $ --> +<!-- $Revision: 1.11 $ --> <sect1 xml:id="language.oop5.interfaces" xmlns="http://docbook.org/ns/docbook"> <title>Object Interfaces</title> <para> @@ -30,6 +30,12 @@ it would cause ambiguity. </para> </note> + <note> + <para> + Interfaces can be extended like classes using the <literal>extend</literal> + operator. + </para> + </note> </sect2> <sect2 xml:id="language.oop5.interfaces.examples"> &reftitle.examples; @@ -83,6 +89,46 @@ ]]> </programlisting> </example> + <example xml:id="language.oop5.interfaces.examples.ex2"> + <title>Extendable Interfaces</title> + <programlisting role="php"> +<![CDATA[ +interface a +{ + public function foo(); +} + +interface b extends a +{ + public function baz(Baz $baz); +} + +// This will work +class c implements b +{ + public function foo() + { + } + + public function baz(Baz $baz) + { + } +} + +// This will not work and result in a fatal error +class d implements b +{ + public function foo() + { + } + + public function baz(Foo $foo) + { + } +} +]]> + </programlisting> + </example> <simpara> See also the <link linkend="language.operators.type">instanceof</link> operator.

« previous php.doc.cvs (#2017) next »