nforbes Tue Jul 19 22:30:20 2005 EDT
Modified files:
/phpdoc/en/language/oop5 interfaces.xml
Log:
Organizational changes; removed redundancy
http://cvs.php.net/diff.php/phpdoc/en/language/oop5/interfaces.xml?r1=1.5&r2=1.6&ty=u
Index: phpdoc/en/language/oop5/interfaces.xml
diff -u phpdoc/en/language/oop5/interfaces.xml:1.5
phpdoc/en/language/oop5/interfaces.xml:1.6
--- phpdoc/en/language/oop5/interfaces.xml:1.5 Wed Sep 22 21:30:05 2004
+++ phpdoc/en/language/oop5/interfaces.xml Tue Jul 19 22:30:19 2005
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.5 $ -->
+<!-- $Revision: 1.6 $ -->
<sect1 id="language.oop5.interfaces">
<title>Object Interfaces</title>
<para>
@@ -10,23 +10,26 @@
<para>
Interfaces are defined using the interface keyword, in the same way as a
standard class, but without any of the methods having their contents
- defined. Classes which implement an interface should do so using the
- implements keyword, and must have definitions for all the methods listed
- in the interface. Classes may implement more than one interface if desired
- by listing each interface split by a comma.
+ defined.
</para>
<para>
All methods declared in an interface must be public, this is the nature of
an
interface.
</para>
- <para>
- Stating that a class implements an interface, and then not implementing all
- the methods in the interface will result in a fatal error telling you which
- methods have not been implemented.
- </para>
- <example>
- <title>Interface example</title>
- <programlisting role="php">
+ <sect2>
+ <title><literal>implements</literal></title>
+ <para>
+ To implement an interface, the <literal>implements</literal> operator is
used.
+ All methods in the interface must be implemented within a class; failure
to do
+ so will result in a fatal error. Classes may implement more than one
interface
+ if desired by separating each interface with a comma.
+ </para>
+ </sect2>
+ <sect2>
+ &reftitle.examples;
+ <example>
+ <title>Interface example</title>
+ <programlisting role="php">
<![CDATA[
<?php
// Declare the interface 'iTemplate'
@@ -72,8 +75,12 @@
?>
]]>
- </programlisting>
- </example>
+ </programlisting>
+ </example>
+ <simpara>
+ See also the <link linkend="operators.type">instanceof</link> operator.
+ </simpara>
+ </sect2>
</sect1>