cvs: phpdoc-de /language/oop5 interfaces.xml

From: Date: Sat, 18 Oct 2008 11:11:35 +0000
Subject: cvs: phpdoc-de /language/oop5 interfaces.xml
Groups: php.doc.de 
Request: Send a blank email to doc-de+get-2838@lists.php.net to get a copy of this message
hholzgra Sat Oct 18 11:11:35 2008 UTC Modified files: /phpdoc-de/language/oop5 interfaces.xml Log: translation update http://cvs.php.net/viewvc.cgi/phpdoc-de/language/oop5/interfaces.xml?r1=1.7&r2=1.8&diff_format=u Index: phpdoc-de/language/oop5/interfaces.xml diff -u phpdoc-de/language/oop5/interfaces.xml:1.7 phpdoc-de/language/oop5/interfaces.xml:1.8 --- phpdoc-de/language/oop5/interfaces.xml:1.7 Sat Oct 18 07:25:56 2008 +++ phpdoc-de/language/oop5/interfaces.xml Sat Oct 18 11:11:35 2008 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- $Revision: 1.7 $ --> -<!-- EN-Revision: 1.10 Maintainer: hholzgra Status: working --> +<!-- $Revision: 1.8 $ --> +<!-- EN-Revision: 1.14 Maintainer: hholzgra Status: ready --> <sect1 xml:id="language.oop5.interfaces" xmlns="http://docbook.org/ns/docbook"> <title>Interfaces</title> <para> @@ -33,6 +33,21 @@ teilen, implementieren, da dies zu Doppeldeutigkeiten führen würde. </para> </note> + <note> + <para> + Ein Interface kann ebenso wie eine Klasse mit Hilfe des Schlüsselwortes + <literal>extend</literal> erweitert werden. + </para> + </note> + </sect2> + <sect2 xml:id="language.oop5.interfaces.constants"> + <title><literal>Konstanten</literal></title> + <para> + Ein Interface kann konstanten definieren. Inferface Konstanten funktionieren + genau so wie <link linkend="language.oop5.constants">Klassenkonstanten</link>. + Eine Interfacekonstante kann von anderen Interfaces oder Klassen die von + diesem Interface erben nicht verändert werden. + </para> </sect2> <sect2 xml:id="language.oop5.interfaces.examples"> &reftitle.examples; @@ -86,6 +101,110 @@ ]]> </programlisting> </example> + <example xml:id="language.oop5.interfaces.examples.ex2"> + <title>Interface Vererbung</title> + <programlisting role="php"> +<![CDATA[ +<?php +interface a + +public function foo(); + + +interface b extends a +{ + public function baz(Baz $baz); +} + +// Dies Funktioniert +class c implements b +{ + public function foo() + { + } + + public function baz(Baz $baz) + { + } +} + +// Dies funktioniert nicht und führt zu einem fatalen Fehler +class d implements b +{ + public function foo() + { + } + + public function baz(Foo $foo) + { + } +} +?> +]]> + </programlisting> + </example> + <example xml:id="language.oop5.interfaces.examples.ex3"> + <title>Interface Mehrfachvererbung</title> + <programlisting role="php"> +<![CDATA[ +<?php +interface a +{ + public function foo(); +} + +interface b +{ + public function bar(); +} + +interface c extends a, b +{ + public function baz(); +} + +class d implements c +{ + public function foo() + { + } + + public function bar() + { + } + + public function baz() + { + } +} +?> +]]> + </programlisting> + </example> + <example xml:id="language.oop5.interfaces.examples.ex4"> + <title>Interfaces with constants</title> + <programlisting role="php"> +<![CDATA[ +<?php +interface a +{ + const b = 'Interface constant'; +} + +// Ausgabe: Interface constant +echo a::b; + +// Der folgende Abschnitt wird nicht funktionieren da +// ein Überschreiben der Kontsanten nicht gestattet ist. +// Dies ist das gleiche Konzept wie bei Klassenkonstanten. +class b implements a +{ + const b = 'Class constant'; +} +?> +]]> + </programlisting> + </example> <simpara> Siehe auch den <link linkend="language.operators.type">instanceof</link> Operator.

« previous php.doc.de (#2838) next »