svn: /phpdoc/zh/trunk/language/oop5/ decon.xml
[email protected] (Dai Jie) Tue, 01 Dec 2020 04:47:06 +0000
| Newsgroups | php.doc.zh |
|---|---|
| Message-ID | <[email protected]> |
daijie Tue, 01 Dec 2020 04:47:06 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=351810
Log:
Sync with en
Changed paths:
U phpdoc/zh/trunk/language/oop5/decon.xml
Modified: phpdoc/zh/trunk/language/oop5/decon.xml
===================================================================
--- phpdoc/zh/trunk/language/oop5/decon.xml 2020-12-01 02:20:58 UTC (rev 351809)
+++ phpdoc/zh/trunk/language/oop5/decon.xml 2020-12-01 04:47:06 UTC (rev 351810)
@@ -211,13 +211,10 @@
三个 static 方法展示了对象以不同方式的实例化方式。
</para>
<simplelist>
- <member><code>fromBasicData()</code> takes the exact parameters that are needed, then creates the
- object by calling the constructor and returning the result.</member>
- <member><code>fromJson()</code> accepts a JSON string and does some pre-processing on it itself
- to convert it into the format desired by the constructor. It then returns the new object.</member>
- <member><code>fromXml()</code> accepts an XML string, preprocesses it, and then creates a bare
- object. The constructor is still called, but as all of the parameters are optional the method
- skips them. It then assigns values to the object properties directly before returning the result.</member>
+ <member><code>fromBasicData()</code> 把所需的全部参数传入构造器,创建对象并返回结果。</member>
+ <member><code>fromJson()</code> 接受 JSON 字符串,,预处理成构造器所需的格式,然后返回新的对象。</member>
+ <member><code>fromXml()</code> 接受 XML 字符串并解析,然后创建一个单纯的对象。
+ 由于参数都是可选的,使得可以忽略所有参数去调用构造器。然后为对象的属性赋值后返回结果。</member>
</simplelist>
<para>
在以上三个例子中,<code>static</code> 关键词会被翻译成代码所在类的类名。