Fixed PHP bug #52494 (description of keyword "new")

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@302259 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Daniel Egeberg 2010-08-15 07:39:53 +00:00
parent de537ccab1
commit 6e133c0d53

View file

@ -111,14 +111,19 @@ $this is not defined.
<sect2 xml:id="language.oop5.basic.new">
<title>new</title>
<para>
To create an instance of a class, a new object must be created and
assigned to a variable. An object will always be assigned when
creating a new object unless the object has a
To create an instance of a class, the <literal>new</literal> keyword must
be used. An object will always be created when unless the object has a
<link linkend="language.oop5.decon">constructor</link> defined that throws an
<link linkend="language.exceptions">exception</link> on error. Classes
should be defined before instantiation (and in some cases this is a
requirement).
</para>
<para>
If a <type>string</type> containing the name of a class is used with
<literal>new</literal>, a new instance of that class will be created. If
the class is in a namespace, its fully qualified name must be used when
doing this.
</para>
<example>
<title>Creating an instance</title>
<programlisting role="php">