curt Fri Aug 6 19:50:51 2004 EDT
Modified files:
/phpdoc/en/language/oop5 decon.xml
Log:
WS Fix
http://cvs.php.net/diff.php/phpdoc/en/language/oop5/decon.xml?r1=1.1&r2=1.2&ty=u
Index: phpdoc/en/language/oop5/decon.xml
diff -u phpdoc/en/language/oop5/decon.xml:1.1 phpdoc/en/language/oop5/decon.xml:1.2
--- phpdoc/en/language/oop5/decon.xml:1.1 Sun Jul 11 08:33:25 2004
+++ phpdoc/en/language/oop5/decon.xml Fri Aug 6 19:50:50 2004
@@ -1,92 +1,93 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.1 $ -->
+<!-- $Revision: 1.2 $ -->
<sect1 id="language.oop5.decon">
<title>Constructors and Destructors</title>
+
<sect2 id="oop5-decon-constructor">
- <title>Constructor</title>
- <para>
- PHP 5 allows developers to declare constructor methods for classes.
- Classes which have a constructor method call this method on each
- newly-created object, so it is suitable for any initialization that the
- object may need before it is used.
- </para>
- <note>
- <simpara>
- Parent constructors are not called implicitly. In order to run
- a parent constructor, a call to
- <function>parent::__construct</function> is required.
- </simpara>
- </note>
- <example>
- <title>using new unified constructors</title>
- <programlisting role="php">
+ <title>Constructor</title>
+ <para>
+ PHP 5 allows developers to declare constructor methods for classes.
+ Classes which have a constructor method call this method on each
+ newly-created object, so it is suitable for any initialization that the
+ object may need before it is used.
+ </para>
+ <note>
+ <simpara>
+ Parent constructors are not called implicitly. In order to run
+ a parent constructor, a call to
+ <function>parent::__construct</function> is required.
+ </simpara>
+ </note>
+ <example>
+ <title>using new unified constructors</title>
+ <programlisting role="php">
<![CDATA[
<?php
class BaseClass {
- function __construct() {
- print "In BaseClass constructor\n";
- }
+ function __construct() {
+ print "In BaseClass constructor\n";
+ }
}
class SubClass extends BaseClass {
- function __construct() {
- parent::__construct();
- print "In SubClass constructor\n";
- }
+ function __construct() {
+ parent::__construct();
+ print "In SubClass constructor\n";
+ }
}
$obj = new BaseClass();
$obj = new SubClass();
?>
]]>
- </programlisting>
- </example>
- <para>
- For backwards compatibility, if PHP 5 cannot find a
- <function>__construct</function> function for a given class, it will
- search for the old-style constructor function, by the name of the class.
- Effectively, it means that the only case that would have compatibility
- issues is if the class had a method named
- <function>__construct</function> which was used for different semantics.
- </para>
+ </programlisting>
+ </example>
+ <para>
+ For backwards compatibility, if PHP 5 cannot find a
+ <function>__construct</function> function for a given class, it will
+ search for the old-style constructor function, by the name of the class.
+ Effectively, it means that the only case that would have compatibility
+ issues is if the class had a method named
+ <function>__construct</function> which was used for different semantics.
+ </para>
</sect2>
<sect2 id="oop5-decon-destructor">
- <title>Destructor</title>
- <para>
- PHP 5 introduces a destructor concept similar to that of other
- object-oriented languages, such as Java: When the last reference to an
- object is destroyed the object's destructor, which is a class method
- named <function>__destruct</function> that receives no parameters, is
- called before the object is freed from memory.
- </para>
- <example>
- <title>Destructor Example</title>
- <programlisting role="php">
+ <title>Destructor</title>
+ <para>
+ PHP 5 introduces a destructor concept similar to that of other
+ object-oriented languages, such as Java: When the last reference to an
+ object is destroyed the object's destructor, which is a class method
+ named <function>__destruct</function> that receives no parameters, is
+ called before the object is freed from memory.
+ </para>
+ <example>
+ <title>Destructor Example</title>
+ <programlisting role="php">
<![CDATA[
<?php
class MyDestructableClass {
- function __construct() {
- print "In constructor\n";
- $this->name = "MyDestructableClass";
- }
-
- function __destruct() {
- print "Destroying " . $this->name . "\n";
- }
+ function __construct() {
+ print "In constructor\n";
+ $this->name = "MyDestructableClass";
+ }
+
+ function __destruct() {
+ print "Destroying " . $this->name . "\n";
+ }
}
$obj = new MyDestructableClass();
?>
]]>
- </programlisting>
- </example>
- <para>
- Like constructors, parent destructors will not be called implicitly by
- the engine. In order to run a parent destructor, one would have to
- explicitly call <function>parent::__destruct</function> in the destructor
- body.
- </para>
+ </programlisting>
+ </example>
+ <para>
+ Like constructors, parent destructors will not be called implicitly by
+ the engine. In order to run a parent destructor, one would have to
+ explicitly call <function>parent::__destruct</function> in the destructor
+ body.
+ </para>
</sect2>
</sect1>