cvs: phpdoc-zh /language oop.xml
| From: | Shaolei Mu | Date: | Thu, 08 Aug 2002 09:41:37 +0000 |
| Subject: | cvs: phpdoc-zh /language oop.xml | ||
| Groups: | php.doc.zh | ||
| Request: | Send a blank email to doc-zh+get-284@lists.php.net to get a copy of this message | ||
verdana Thu Aug 8 05:41:37 2002 EDT
Modified files:
/phpdoc-zh/language oop.xml
Log:
Index: phpdoc-zh/language/oop.xml diff -u phpdoc-zh/language/oop.xml:1.2 phpdoc-zh/language/oop.xml:1.3 --- phpdoc-zh/language/oop.xml:1.2 Sun Jul 14 04:02:38 2002 +++ phpdoc-zh/language/oop.xml Thu Aug 8 05:41:37 2002 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <chapter id="language.oop"> <title>ÀàÓë¶ÔÏó</title> @@ -163,46 +163,33 @@ </informalexample> <para> - Within a class definition, you do not know under which name the object will - be accessible in your program: at the time the Cart class was - written, it was unknown that the object will be named $cart or - $another_cart later. Thus, you cannot write $cart->items within - the Cart class itself. Instead, in order to be able to access it's own - functions and variables from within a class, one can use the - pseudo-variable $this which can be read as 'my own' or - 'current object'. Thus, '$this->items[$artnr] += $num' can - be read as 'add $num to the $artnr counter of my own items - array' or 'add $num to the $artnr counter of the items array - within the current object'. - - ÔÚÒ»¸öÀàµÄ¶¨ÒåÄÚ²¿£¬Äã²»ÖªµÀ + ÔÚÒ»¸öÀàµÄ¶¨ÒåÄÚ²¿£¬ÄãÎÞ·¨µÃ֪ʹÓúÎÖÖÃû³ÆµÄ¶ÔÏóÊÇ¿ÉÒÔ·ÃÎʵģºÔÚ±àд Cart Ààʱ£¬²¢ + ²»ÖªµÀÖ®ºó¶ÔÏóµÄÃû³Æ½«»áÃüÃûΪ $cart »òÕß $another_cart¡£Òò¶øÄã²»ÄÜÔÚÀàÖÐʹÓà + $cart->items¡£È»¶øÎªÁËÀඨÒåµÄÄÚ²¿·ÃÎÊ×ÔÉíµÄº¯ÊýºÍ±äÁ¿£¬ ¿ÉÒÔʹÓÃα±äÁ¿ $this + À´´ïµ½Õâ¸öÄ¿µÄ¡£$this ±äÁ¿¿ÉÒÔÀí½âΪ¡®ÎÒ×Ô¼ºµÄ¡¯»òÕß¡®µ±Ç°¶ÔÏ󡯡£Òò¶ø + ¡®$this->>items[$artnr] += $num¡¯ ¿ÉÒÔÀí½âΪ¡®ÎÒ×Ô¼ºµÄÎïÆ·Êý×éµÄ $artnr ¼ÆÊýÆ÷¼Ó $num¡¯ + »òÕß ¡®ÔÚµ±Ç°¶ÔÏóµÄÎïÆ·Êý×éµÄ $artnr ¼ÆÊýÆ÷¼Ó $num¡¯¡£ </para> <note> <para> ÓÐһЩ²»´íµÄº¯ÊýÓÃÀ´´¦ÀíÀàºÍ¶ÔÏó¡£ÄãÓ¦¸Ã¹Ø×¢Ò»Ï - <link linkend="ref.classobj">Class/Object Functions</link>¡£ + <link linkend="ref.classobj">Àà/¶ÔÏó º¯Êý</link>¡£ </para> </note> </sect1> <sect1 id="keyword.extends"> - <title><literal>extends</literal></title> + <title><literal>¼Ì³Ð</literal></title> <para> - Often you need classes with similar variables and functions - to another existing class. In fact, it is good practice to - define a generic class which can be used in all your - projects and adapt this class for the needs of each of your - specific projects. To facilitate this, classes can be - extensions of other classes. The extended or derived class - has all variables and functions of the base class (this is - called 'inheritance' despite the fact that nobody died) and what - you add in the extended definition. It is not possible to - substract from a class, that is, to undefine any existing - functions or variables. An extended class is always dependent - on a single base class, that is, multiple inheritance is - not supported. Classes are extended using the keyword 'extends'. + ͨ³£ÄãÐèÒªÕâÑùһЩÀ࣬ÕâЩÀàÓëÆäËüÏÖÓеÄÀàÓµÓÐÏàͬ±äÁ¿ºÍº¯Êý¡£Êµ¼ÊÉÏ£¬¶¨ÒåÒ»¸ö + ͨÓÃÀ࣬ÓÃÓÚÄãËùÓеÄÏîÄ¿£¬²¢ÇÒ²»¶Ï·á¸»Õâ¸öÀàÒÔÊÊÓ¦ÄãµÄÿ¸ö¾ßÌåÏîÄ¿£¬½«ÊÇÒ»¸ö²»´í + µÄÁ·Ï°¡£ÎªÁËʹÕâÒ»µã±äµÃ¸ü¼ÓÈÝÒ×£¬Àà¿ÉÒÔ´ÓÆäËüµÄÀàÖÐÀ©Õ¹³öÀ´¡£À©Õ¹»òÅÉÉú³öÀ´µÄÀà + ÓµÓÐÆä»ùÀࣨthis is called 'inheritance' despite the fact that nobody died£© + µÄËùÓбäÁ¿ºÍº¯Êý£¬²¢°üº¬ËùÓÐÄãÔÚÅÉÉúÀàÖж¨ÒåµÄ²¿·Ö¡£ÀàÖеÄÔªËØ²»¿ÉÄܼõÉÙ£¬¾ÍÊÇ˵£¬ + ²»¿ÉÒÔ×¢ÏúÈκδæÔڵĺ¯Êý»òÕß±äÁ¿¡£Ò»¸öÀ©³äÀà×ÜÊÇÒÀÀµÒ»¸öµ¥¶ÀµÄ»ùÀ࣬Ҳ¾ÍÊÇ˵£¬ + ¶à¼Ì³ÐÊDz»Ö§³ÖµÄ¡£Ê¹Óùؼü×Ö¡®extends¡¯À´À©Õ¹Ò»¸öÀà¡£ </para> <informalexample> @@ -222,11 +209,10 @@ </informalexample> <para> - This defines a class Named_Cart that has all variables and - functions of Cart plus an additional variable $owner and an - additional function set_owner(). You create a named cart the usual - way and can now set and get the carts owner. You can still use - normal cart functions on named carts: + ÉÏÊöʾÀý¶¨ÒåÁËÃûΪ Named_Cart µÄÀ࣬¸ÃÀàÓµÓÐ Cart ÀàµÄËùÓбäÁ¿ºÍº¯Êý£¬¼ÓÉÏ + ¸½¼ÓµÄ±äÁ¿ $owner ºÍÒ»¸ö¸½¼Óº¯Êý set_owner()¡£ÏÖÔÚ£¬ÄãÒÔÕý³£µÄ·½Ê½´´½¨ÁËÒ» + ¸ö named cart£¬²¢ÇÒ¿ÉÒÔÉèÖò¢È¡µÃ carts µÄËùÓÐÕß¡£¶øÕý³£µÄ cart ÀàµÄº¯ÊýÒÀ¾É + ¿ÉÒÔÔÚ named carts ÖÐʹÓ㺠</para> <informalexample> @@ -241,44 +227,34 @@ </informalexample> <para> - This is also called a "parent-child" relationship. You create a class, - parent, and use <literal>extends</literal> to create a new class - <emphasis>based</emphasis> on the parent class: the child class. You can - even use this new child class and create another class based on this child - class. + Õâ¸öÒ²¿ÉÒÔ½Ð×ö¡°¸¸£×Ó¡±¹ØÏµ¡£Äã´´½¨Ò»¸öÀ࣬¸¸À࣬²¢Ê¹Óà <literal>extends</literal> + À´´´½¨Ò»¸ö <emphasis>»ùÓÚ</emphasis> ¸¸ÀàµÄÐÂÀࣺ×ÓÀà¡£ÄãÉõÖÁ¿ÉÒÔʹÓÃÕâ¸öеÄ×ÓÀàÀ´ + ´´½¨ÁíÍâÒ»¸ö»ùÓÚÕâ¸ö×ÓÀàµÄÀà¡£ </para> <note> <para> - Classes must be defined before they are used! If you want the class - <literal>Named_Cart</literal> to extend the class - <literal>Cart</literal>, you will have to define the class - <literal>Cart</literal> first. If you want to create another class called - <literal>Yellow_named_cart</literal> based on the class - <literal>Named_Cart</literal> you have to define - <literal>Named_Cart</literal> first. To make it short: the order in which - the classes are defined is important. + ÀàÖ»ÓÐÔÚ¶¨Òåºó²Å¿ÉÒÔʹÓã¡Èç¹ûÄãÐëÒªÀà <literal>Named_Cart</literal> ¼Ì³ÐÀà <literal>Cart</literal>£¬ + Äã±ØÐëÊ×Ïȶ¨Òå <literal>Cart</literal> Àà¡£Èç¹ûÄãÐëÒª´´½¨ÁíÒ»¸ö»ùÓÚ <literal>Named_Cart</literal> Àà + µÄ <literal>Yellow_named_cart </literal> À࣬Äã±ØÐëÊ×Ïȶ¨Òå <literal>Named_Cart</literal> Àà¡£ + ¼ò½ÝµÄ˵£ºÀඨÒåµÄ˳ÐòÊǷdz£ÖØÒªµÄ¡£ </para> </note> </sect1> <sect1 id="language.oop.constructor"> - <title><literal>Constructors</literal></title> + <title><literal>¹¹Ô캯Êý</literal></title> <caution> <simpara> - In PHP 3 and PHP 4 constructors behave differently. The PHP 4 - semantics are strongly preferred. + PHP 3 ºÍ PHP4 µÄ¹¹Ô캯ÊýÓÐËù²»Í¬¡£PHP 4 µÄÓïÒå¸ü¿ÉÈ¡¡£ </simpara> </caution> <para> - Constructors are functions in a class that are automatically - called when you create a new instance of a class with - <literal>new</literal>. In PHP 3, a - function becomes a constructor when it has the same name as - the class. In PHP 4, a function becomes a constructor, when - it has the same name as the class it is defined in - the - difference is subtle, but crucial (see below). + ¹¹Ô캯ÊýÊÇÀàÖеÄÒ»¸öÌØÊ⺯Êý£¬µ±Ê¹Óà <literal>new</literal> ²Ù×÷·û + ´´½¨Ò»¸öÀàµÄʵÀýʱ£¬¹¹Ô캯Êý½«»á×Ô¶¯µ÷Óá£PHP 3 ÖУ¬µ±º¯ÊýÓÚÀàͬÃûʱ£¬ + Õâ¸öº¯Êý½«³ÉΪ¹¹Ô캯Êý¡£PHP 4 £¬ÀàÖж¨ÒåµÄº¯ÊýÓëÀàͬÃûʱ£¬Õâ¸öº¯Êý½« + ³ÉΪһ¸ö¹¹Ô캯Êý£Çø±ðºÜ΢Ãµ«·Ç³£¹Ø¼ü£¨¼ûÏÂÎÄ£©¡£ </para> <informalexample> @@ -297,13 +273,10 @@ </informalexample> <para> - This defines a class Auto_Cart that is a Cart plus a constructor - which initializes the cart with one item of article number "10" - each time a new Auto_Cart is being made with "new". Constructors - can take arguments and these arguments can be optional, which - makes them much more useful. To be able to still use the class - without parameters, all parameters to constructors should be - made optional by providing default values. + ÉÏÎ͍ÒåÁËÒ»¸ö Auto_Cart À࣬¼´ Cart Àà¼ÓÉÏÒ»¸ö¹¹Ô캯Êý£¬µ±Ã¿´ÎʹÓà "new" ´´½¨ + Ò»¸öÐ嵀 Auto_Cart ÀàʵÀýʱ£¬¹¹Ô캯Êý½«×Ô¶¯µ÷Óò¢½«Ò»¼þÉÌÆ·µÄÊýÄ¿³õʼ»¯Îª ¡°10¡±¡£ + ¹¹Ô캯Êý¿ÉÒÔʹÓòÎÊý£¬¶øÇÒÕâЩ²ÎÊý¿ÉÑ¡µÄ£¬ËüÃÇ¿ÉÒÔʹ¹¹Ô캯Êý¸ü¼ÓÓÐÓá£ÎªÁËÒÀÈ»¿ÉÒÔ + ²»´ø²ÎÊýµÄʹÓÃÀ࣬ËùÓй¹Ô캯ÊýµÄ²ÎÊýÓ¦¸ÃÌṩĬÈÏÖµ£¬Ê¹Æä¿ÉÑ¡¡£ </para> <informalexample> @@ -330,16 +303,14 @@ </informalexample> <para> - You also can use the <literal>@</literal> operator to - <emphasis>mute</emphasis> errors occuring in the constructor, e.g. + ÄãÒ²¿ÉÒÔʹÓà <literal>@</literal> ²Ù×÷·ûÀ´ <emphasis>Ïû³ý</emphasis> ·¢ÉúÔÚ¹¹Ô캯ÊýÖеĴíÎó¡£e.g. <literal>@new</literal>. + </para> <caution> <simpara> - In PHP 3, derived classes and constructors have a number of - limitations. The following examples should be read carefully - to understand these limitations. + PHP 3£¬ÅÉÉúÀàºÍ¹¹Ô캯ÊýÓÐÐí¶àÏÞÖÆ¡£×ÐϸÔĶÁÏÂÁз¶ÀýÒÔÀí½âÕâЩÏÞÖÆ¡£ </simpara> </caution> @@ -369,17 +340,13 @@ </informalexample> <para> - In PHP 3, no constructor is being called in the above example. - The rule in PHP 3 is: 'A constructor is a function of the same - name as the class.'. The name of the class is B, and there is - no function called B() in class B. Nothing happens. + PHP 3£¬ÔÚÉÏÃæµÄʾÀýÖн«²»»áÓй¹Ô캯Êý±»µ÷Óá£PHP 3 µÄ¹æÔòÊÇ£º¡°¹¹Ô캯ÊýÊÇÓëÀà + ͬÃûµÄº¯Êý¡±¡£ÕâÀÀàµÄÃû×ÖÊÇ B£¬µ«ÊÇÀà B ÖÐûÓк¯Êý B()¡£Ê²Ã´Ò²²»»á·¢Éú¡£ </para> <para> - This is fixed in PHP 4 by introducing another rule: If a class - has no constructor, the constructor of the base class is being - called, if it exists. The above example would have printed - 'I am the constructor of A.<br>' in PHP 4. + PHP 4 ÐÞÕýÁËÕâ¸öÎÊÌ⣬²¢½éÉÜÁËÁíÍâµÄйæÔò£ºÈç¹ûÒ»¸öÀàûÓй¹Ô캯Êý£¬Èç¹û¸¸ÀàÓй¹Ôì + º¯ÊýµÄ»°£¬¸¸ÀàµÄ¹¹Ô캯Êý½«»á±»µ÷Óá£PHP 4 ÖУ¬ÉÏÃæµÄÀý×Ó½«»áÊä³ö¡°I am the constructor of A.<br>¡±¡£ </para> <informalexample> @@ -414,43 +381,40 @@ </informalexample> <para> - In PHP 3, the function B() in class A will suddenly become a - constructor in class B, although it was never intended to be. - The rule in PHP 3 is: 'A constructor is a function of the same - name as the class.'. PHP 3 does not care if the function is - being defined in class B, or if it has been inherited. + Èç¹ûÊÇ PHP 3£¬A ÀàÖеĺ¯Êý B() ½«Á¢¼´³ÉΪÀà B ÖеĹ¹Ô캯Êý£¬ËäÈ»²¢²»ÊÇÓÐÒâÈç´Ë¡£ + PHP 3 ÖеĹæÔòÊÇ£º¡°¹¹Ô캯ÊýÊÇÓëÀàͬÃûµÄº¯Êý¡±¡£PHP 3 ²¢²»¹ØÐĺ¯ÊýÊDz»ÊÇÔÚ B Àà + Öж¨ÒåµÄ£¬»òÕßÊÇ·ñÒѾ±»¼Ì³Ð¡£ </para> <para> - This is fixed in PHP 4 by modifying the rule to: 'A constructor - is a function of the same name as the class it is being defined - in.'. Thus in PHP 4, the class B would have no constructor function - of its own and the constructor of the base class would have been - called, printing 'I am the constructor of A.<br>'. + PHP 4 ÐÞ¸ÄÁ˹æÔò£º¡°¹¹Ô캯ÊýÓ붨ÒåÆä×ÔÉíµÄÀàͬÃû¡±¡£Òò¶øÔÚ PHP 4 ÖУ¬Àà B ½« + ²»»áÓÐÊôÓÚ×ÔÉíµÄ¹¹Ô캯Êý£¬²¢ÇÒ¸¸ÀàµÄ¹¹Ô캯Êý½«»á±»µ÷Ó㬴òÓ¡³ö + ¡°I am the constructor of A.<br>¡±¡£ + + [ÒëÕß×¢,by Verdana: ÕâÀïËÆºõÓÐÎÊÌ⣬ʵ¼ÊÊä³öµÄ½á¹û£¬²¢²»ÏóÕâÀï˵µÄÄÇÑù¡£Êµ¼ÊÊä³öµÄ + ÄÚÈÝÊÇ¡°I am a regular function named B in class A......¡±£¬Êä³öµÄÊÇ B() µÄÄÚÈÝ + Ò²¾ÍÊÇ˵£¬Àý×ÓÖеÄ×¢ÊÍ¡°This will call B() as a constructor¡±ÊÇÕýÈ·µÄ¡£Èç¹û´Ó A Àà + ÖÐÒÆ³ýº¯Êý B()£¬ÄÇô½«Êä³ö A() µÄÄÚÈÝ¡£] </para> <caution> <simpara> - Neither PHP 3 nor PHP 4 call constructors of the base class - automatically from a constructor of a derived class. It is - your responsibility to propagate the call to constructors - upstream where appropriate. + ²»¹ÜÊÇ PHP 3 »¹ÊÇ PHP 4 ¶¼²»ÄÜ´ÓÅÉÉúÀàµÄ¹¹Ô캯ÊýÖÐ×Ô¶¯µ÷ÓûùÀàµÄ¹¹Ô캯Êý¡£ + It is your reponsibility to prapagater the call to constructors + upstream where appropriate. </simpara> </caution> <note> <simpara> - There are no destructors in PHP 3 or PHP 4. You may use - <function>register_shutdown_function</function> instead - to simulate most effects of destructors. + PHP 3 »òÕß PHP 4 Öж¼Ã»ÓÐÎö¹¹º¯Êý¡£Äã¿ÉÒÔʹÓà <function>register_shutdown_function</function> + º¯ÊýÀ´Ä£Äâ¶àÊýÎö¹¹º¯ÊýµÄЧ¹û¡£ </simpara> </note> <para> - Destructors are functions that are called automatically - when an object is destroyed, either with <function>unset</function> - or by simply going out of scope. There are no destructors - in PHP. + µ±¶ÔÏó±»Ïú»Ù£¬Ê¹Óà <function>unset</function> »òÕß¼òµ¥µÄÍÑÀ뷶Χ£¬Îö¹¹º¯Êý¶¼»á×Ô¶¯µ÷Óᣠ+ µ« PHP ÖÐûÓÐÎö¹¹º¯Êý¡£ </para> </sect1> @@ -459,15 +423,13 @@ <caution> <simpara> - The following is valid for PHP 4 only. + ÏÂÁÐÄÚÈݽöÔÚ PHP 4 ÖÐÓÐЧ¡£ </simpara> </caution> <para> - Sometimes it is useful to refer to functions and variables - in base classes or to refer to functions in classes that - have not yet any instances. The :: operator is being used - for this. + ÓÐʱ£¬ÔÚûÓÐÉùÃ÷ÈκÎʵÀýµÄÇé¿öÏ·ÃÎÊÀàÖеĺ¯Êý»òÕß»ùÀàÖеĺ¯ÊýºÍ±äÁ¿ºÜÓÐÓô¦¡£ + ¶ø :: ²Ù×÷·û¼´ÓÃÓÚ´ËÇé¿ö¡£ </para> <informalexample> @@ -507,36 +469,27 @@ </informalexample> <para> - The above example calls the function example() in - class A, but there is no object of class A, so that - we cannot write $a->example() or similar. Instead we - call example() as a 'class function', that is, as a - function of the class itself, not any object of that - class. + ÉÏÃæµÄÀý×Óµ÷ÓÃÁË A ÀàµÄº¯Êý example()£¬µ«ÊÇÕâÀï²¢²»´æÔÚ A ÀàµÄ¶ÔÏó£¬ + Òò´Ë²»ÄÜÕâÑùÓà $a->example() »òÕßÀàËÆµÄ·½·¨µ÷Óà example()¡£·´¶øÎÒÃÇ + ½« example() ×÷Ϊһ¸öÀຯÊýÀ´µ÷Óã¬Ò²¾ÍÊÇ˵£¬×÷Ϊһ¸öÀà×ÔÉíµÄº¯ÊýÀ´µ÷Óà + £¬¶ø²»ÊÇÕâ¸öÀàµÄÈκζÔÏó¡£ </para> <para> - There are class functions, but there are no class variables. - In fact, there is no object at all at the time of the call. - Thus, a class function may not use any object variables (but - it can use local and global variables), and it may no use - $this at all. + ÕâÀïÓÐÀຯÊý£¬µ«Ã»ÓÐÀàµÄ±äÁ¿¡£Êµ¼ÊÉÏ£¬ÔÚµ÷Óú¯ÊýʱÍêȫûÓÐÈκζÔÏó¡£Òò¶ø + Ò»¸öÀàµÄº¯Êý¿ÉÒÔ²»Ê¹ÓÃÈκζÔÏ󣨵«¿ÉÒÔʹÓþֲ¿»òÕßÈ«¾Ö±äÁ¿£©£¬²¢ÇÒ¿ÉÒÔ¸ù±¾ + ²»Ê¹Óà $this ±äÁ¿¡£ </para> <para> - In the above example, class B redefines the function example(). - The original definition in class A is shadowed - and no longer available, unless you are refering specifically - to the implementation of example() in class A using the - ::-operator. Write A::example() to do this (in fact, you - should be writing parent::example(), as shown in the next - section). + ÉÏÃæµÄÀý×ÓÖУ¬Àà B ÖØÐ¶¨ÒåÁ˺¯Êý example()¡£A ÀàÖÐÔʼ¶¨ÒåµÄº¯Êý example() + ½«±»ÆÁ±Î²¢ÇÒ²»ÔÙÉúЧ£¬³ý·ÇÄãʹÓà :: ²Ù×÷·ûÀ´·ÃÎÊ A ÀàÖÐµÄ example() º¯Êý¡£ + È磺 A::example() £¨Êµ¼ÊÉÏ£¬Äã±ØÐë±àд parent::example()£¬ÏÂÒ»Õ½éÉܸÃÄÚÈÝ¡££© </para> <para> - In this context, there is a current object and it may - have object variables. Thus, when used from WITHIN an - object function, you may use $this and object variables. + ¾Í´Ë¶øÂÛ£¬¶ÔÓÚµ±Ç°¶ÔÏó£¬Ëü¿ÉÄÜÓжÔÏó±äÁ¿¡£Òò¶ø£¬Äã¿ÉÒÔÔÚ¶ÔÏóº¯ÊýµÄÄÚ²¿ + ʹÓà $this ºÍ¶ÔÏó±äÁ¿¡£ </para> </sect1> @@ -545,10 +498,8 @@ <title><literal>parent</literal></title> <para> - You may find yourself writing code that refers to - variables and functions in base classes. This is - particularly true if your derived class is a refinement - or specialisation of code in your base class. + µ±Äã·¢ÏÖ×Ô¼ºÕýÔÚдһЩ·ÃÎÊ»ùÀàµÄ±äÁ¿ºÍº¯ÊýµÄ´úÂëʱ£¬Õâ³ä·Ö˵Ã÷ÁË + ÄãµÄÅÉÉúÀà·Ç³£µÄ¾«Á·¡¢×¨Òµ¡£ </para> <para> @@ -556,11 +507,14 @@ code, you should be using the special name <literal>parent</literal>, which refers to the name of your base class as given in the <literal>extends</literal> - declation of your class. By doing this, you avoid using the + declaration of your class. By doing this, you avoid using the name of your base class in more than one place. Should your inheritance tree change during implementation, the change is easily made by simply changing the <literal>extends</literal> declaration of your class. + + ÄãÓ¦¸ÃÔÚ´úÂëÖÐʹÓÃרÓÃÃû³Æ <literal>parent</literal> Ìæ´ú»ùÀàµÄÃû³Æ£¬ + À´·ÃÎÊ </para> <informalexample> @@ -593,7 +547,7 @@ </sect1> <sect1 id="language.oop.serialization"> - <title>Serializing objects - objects in sessions</title> + <title>ÐòÁл¯¶ÔÏó£»á»°ÖеĶÔÏó</title> <note> <simpara>
Index: phpdoc-zh/language/oop.xml diff -u phpdoc-zh/language/oop.xml:1.2 phpdoc-zh/language/oop.xml:1.3 --- phpdoc-zh/language/oop.xml:1.2 Sun Jul 14 04:02:38 2002 +++ phpdoc-zh/language/oop.xml Thu Aug 8 05:41:37 2002 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <chapter id="language.oop"> <title>ÀàÓë¶ÔÏó</title> @@ -163,46 +163,33 @@ </informalexample> <para> - Within a class definition, you do not know under which name the object will - be accessible in your program: at the time the Cart class was - written, it was unknown that the object will be named $cart or - $another_cart later. Thus, you cannot write $cart->items within - the Cart class itself. Instead, in order to be able to access it's own - functions and variables from within a class, one can use the - pseudo-variable $this which can be read as 'my own' or - 'current object'. Thus, '$this->items[$artnr] += $num' can - be read as 'add $num to the $artnr counter of my own items - array' or 'add $num to the $artnr counter of the items array - within the current object'. - - ÔÚÒ»¸öÀàµÄ¶¨ÒåÄÚ²¿£¬Äã²»ÖªµÀ + ÔÚÒ»¸öÀàµÄ¶¨ÒåÄÚ²¿£¬ÄãÎÞ·¨µÃ֪ʹÓúÎÖÖÃû³ÆµÄ¶ÔÏóÊÇ¿ÉÒÔ·ÃÎʵģºÔÚ±àд Cart Ààʱ£¬²¢ + ²»ÖªµÀÖ®ºó¶ÔÏóµÄÃû³Æ½«»áÃüÃûΪ $cart »òÕß $another_cart¡£Òò¶øÄã²»ÄÜÔÚÀàÖÐʹÓà + $cart->items¡£È»¶øÎªÁËÀඨÒåµÄÄÚ²¿·ÃÎÊ×ÔÉíµÄº¯ÊýºÍ±äÁ¿£¬ ¿ÉÒÔʹÓÃα±äÁ¿ $this + À´´ïµ½Õâ¸öÄ¿µÄ¡£$this ±äÁ¿¿ÉÒÔÀí½âΪ¡®ÎÒ×Ô¼ºµÄ¡¯»òÕß¡®µ±Ç°¶ÔÏ󡯡£Òò¶ø + ¡®$this->>items[$artnr] += $num¡¯ ¿ÉÒÔÀí½âΪ¡®ÎÒ×Ô¼ºµÄÎïÆ·Êý×éµÄ $artnr ¼ÆÊýÆ÷¼Ó $num¡¯ + »òÕß ¡®ÔÚµ±Ç°¶ÔÏóµÄÎïÆ·Êý×éµÄ $artnr ¼ÆÊýÆ÷¼Ó $num¡¯¡£ </para> <note> <para> ÓÐһЩ²»´íµÄº¯ÊýÓÃÀ´´¦ÀíÀàºÍ¶ÔÏó¡£ÄãÓ¦¸Ã¹Ø×¢Ò»Ï - <link linkend="ref.classobj">Class/Object Functions</link>¡£ + <link linkend="ref.classobj">Àà/¶ÔÏó º¯Êý</link>¡£ </para> </note> </sect1> <sect1 id="keyword.extends"> - <title><literal>extends</literal></title> + <title><literal>¼Ì³Ð</literal></title> <para> - Often you need classes with similar variables and functions - to another existing class. In fact, it is good practice to - define a generic class which can be used in all your - projects and adapt this class for the needs of each of your - specific projects. To facilitate this, classes can be - extensions of other classes. The extended or derived class - has all variables and functions of the base class (this is - called 'inheritance' despite the fact that nobody died) and what - you add in the extended definition. It is not possible to - substract from a class, that is, to undefine any existing - functions or variables. An extended class is always dependent - on a single base class, that is, multiple inheritance is - not supported. Classes are extended using the keyword 'extends'. + ͨ³£ÄãÐèÒªÕâÑùһЩÀ࣬ÕâЩÀàÓëÆäËüÏÖÓеÄÀàÓµÓÐÏàͬ±äÁ¿ºÍº¯Êý¡£Êµ¼ÊÉÏ£¬¶¨ÒåÒ»¸ö + ͨÓÃÀ࣬ÓÃÓÚÄãËùÓеÄÏîÄ¿£¬²¢ÇÒ²»¶Ï·á¸»Õâ¸öÀàÒÔÊÊÓ¦ÄãµÄÿ¸ö¾ßÌåÏîÄ¿£¬½«ÊÇÒ»¸ö²»´í + µÄÁ·Ï°¡£ÎªÁËʹÕâÒ»µã±äµÃ¸ü¼ÓÈÝÒ×£¬Àà¿ÉÒÔ´ÓÆäËüµÄÀàÖÐÀ©Õ¹³öÀ´¡£À©Õ¹»òÅÉÉú³öÀ´µÄÀà + ÓµÓÐÆä»ùÀࣨthis is called 'inheritance' despite the fact that nobody died£© + µÄËùÓбäÁ¿ºÍº¯Êý£¬²¢°üº¬ËùÓÐÄãÔÚÅÉÉúÀàÖж¨ÒåµÄ²¿·Ö¡£ÀàÖеÄÔªËØ²»¿ÉÄܼõÉÙ£¬¾ÍÊÇ˵£¬ + ²»¿ÉÒÔ×¢ÏúÈκδæÔڵĺ¯Êý»òÕß±äÁ¿¡£Ò»¸öÀ©³äÀà×ÜÊÇÒÀÀµÒ»¸öµ¥¶ÀµÄ»ùÀ࣬Ҳ¾ÍÊÇ˵£¬ + ¶à¼Ì³ÐÊDz»Ö§³ÖµÄ¡£Ê¹Óùؼü×Ö¡®extends¡¯À´À©Õ¹Ò»¸öÀà¡£ </para> <informalexample> @@ -222,11 +209,10 @@ </informalexample> <para> - This defines a class Named_Cart that has all variables and - functions of Cart plus an additional variable $owner and an - additional function set_owner(). You create a named cart the usual - way and can now set and get the carts owner. You can still use - normal cart functions on named carts: + ÉÏÊöʾÀý¶¨ÒåÁËÃûΪ Named_Cart µÄÀ࣬¸ÃÀàÓµÓÐ Cart ÀàµÄËùÓбäÁ¿ºÍº¯Êý£¬¼ÓÉÏ + ¸½¼ÓµÄ±äÁ¿ $owner ºÍÒ»¸ö¸½¼Óº¯Êý set_owner()¡£ÏÖÔÚ£¬ÄãÒÔÕý³£µÄ·½Ê½´´½¨ÁËÒ» + ¸ö named cart£¬²¢ÇÒ¿ÉÒÔÉèÖò¢È¡µÃ carts µÄËùÓÐÕß¡£¶øÕý³£µÄ cart ÀàµÄº¯ÊýÒÀ¾É + ¿ÉÒÔÔÚ named carts ÖÐʹÓ㺠</para> <informalexample> @@ -241,44 +227,34 @@ </informalexample> <para> - This is also called a "parent-child" relationship. You create a class, - parent, and use <literal>extends</literal> to create a new class - <emphasis>based</emphasis> on the parent class: the child class. You can - even use this new child class and create another class based on this child - class. + Õâ¸öÒ²¿ÉÒÔ½Ð×ö¡°¸¸£×Ó¡±¹ØÏµ¡£Äã´´½¨Ò»¸öÀ࣬¸¸À࣬²¢Ê¹Óà <literal>extends</literal> + À´´´½¨Ò»¸ö <emphasis>»ùÓÚ</emphasis> ¸¸ÀàµÄÐÂÀࣺ×ÓÀà¡£ÄãÉõÖÁ¿ÉÒÔʹÓÃÕâ¸öеÄ×ÓÀàÀ´ + ´´½¨ÁíÍâÒ»¸ö»ùÓÚÕâ¸ö×ÓÀàµÄÀà¡£ </para> <note> <para> - Classes must be defined before they are used! If you want the class - <literal>Named_Cart</literal> to extend the class - <literal>Cart</literal>, you will have to define the class - <literal>Cart</literal> first. If you want to create another class called - <literal>Yellow_named_cart</literal> based on the class - <literal>Named_Cart</literal> you have to define - <literal>Named_Cart</literal> first. To make it short: the order in which - the classes are defined is important. + ÀàÖ»ÓÐÔÚ¶¨Òåºó²Å¿ÉÒÔʹÓã¡Èç¹ûÄãÐëÒªÀà <literal>Named_Cart</literal> ¼Ì³ÐÀà <literal>Cart</literal>£¬ + Äã±ØÐëÊ×Ïȶ¨Òå <literal>Cart</literal> Àà¡£Èç¹ûÄãÐëÒª´´½¨ÁíÒ»¸ö»ùÓÚ <literal>Named_Cart</literal> Àà + µÄ <literal>Yellow_named_cart </literal> À࣬Äã±ØÐëÊ×Ïȶ¨Òå <literal>Named_Cart</literal> Àà¡£ + ¼ò½ÝµÄ˵£ºÀඨÒåµÄ˳ÐòÊǷdz£ÖØÒªµÄ¡£ </para> </note> </sect1> <sect1 id="language.oop.constructor"> - <title><literal>Constructors</literal></title> + <title><literal>¹¹Ô캯Êý</literal></title> <caution> <simpara> - In PHP 3 and PHP 4 constructors behave differently. The PHP 4 - semantics are strongly preferred. + PHP 3 ºÍ PHP4 µÄ¹¹Ô캯ÊýÓÐËù²»Í¬¡£PHP 4 µÄÓïÒå¸ü¿ÉÈ¡¡£ </simpara> </caution> <para> - Constructors are functions in a class that are automatically - called when you create a new instance of a class with - <literal>new</literal>. In PHP 3, a - function becomes a constructor when it has the same name as - the class. In PHP 4, a function becomes a constructor, when - it has the same name as the class it is defined in - the - difference is subtle, but crucial (see below). + ¹¹Ô캯ÊýÊÇÀàÖеÄÒ»¸öÌØÊ⺯Êý£¬µ±Ê¹Óà <literal>new</literal> ²Ù×÷·û + ´´½¨Ò»¸öÀàµÄʵÀýʱ£¬¹¹Ô캯Êý½«»á×Ô¶¯µ÷Óá£PHP 3 ÖУ¬µ±º¯ÊýÓÚÀàͬÃûʱ£¬ + Õâ¸öº¯Êý½«³ÉΪ¹¹Ô캯Êý¡£PHP 4 £¬ÀàÖж¨ÒåµÄº¯ÊýÓëÀàͬÃûʱ£¬Õâ¸öº¯Êý½« + ³ÉΪһ¸ö¹¹Ô캯Êý£Çø±ðºÜ΢Ãµ«·Ç³£¹Ø¼ü£¨¼ûÏÂÎÄ£©¡£ </para> <informalexample> @@ -297,13 +273,10 @@ </informalexample> <para> - This defines a class Auto_Cart that is a Cart plus a constructor - which initializes the cart with one item of article number "10" - each time a new Auto_Cart is being made with "new". Constructors - can take arguments and these arguments can be optional, which - makes them much more useful. To be able to still use the class - without parameters, all parameters to constructors should be - made optional by providing default values. + ÉÏÎ͍ÒåÁËÒ»¸ö Auto_Cart À࣬¼´ Cart Àà¼ÓÉÏÒ»¸ö¹¹Ô캯Êý£¬µ±Ã¿´ÎʹÓà "new" ´´½¨ + Ò»¸öÐ嵀 Auto_Cart ÀàʵÀýʱ£¬¹¹Ô캯Êý½«×Ô¶¯µ÷Óò¢½«Ò»¼þÉÌÆ·µÄÊýÄ¿³õʼ»¯Îª ¡°10¡±¡£ + ¹¹Ô캯Êý¿ÉÒÔʹÓòÎÊý£¬¶øÇÒÕâЩ²ÎÊý¿ÉÑ¡µÄ£¬ËüÃÇ¿ÉÒÔʹ¹¹Ô캯Êý¸ü¼ÓÓÐÓá£ÎªÁËÒÀÈ»¿ÉÒÔ + ²»´ø²ÎÊýµÄʹÓÃÀ࣬ËùÓй¹Ô캯ÊýµÄ²ÎÊýÓ¦¸ÃÌṩĬÈÏÖµ£¬Ê¹Æä¿ÉÑ¡¡£ </para> <informalexample> @@ -330,16 +303,14 @@ </informalexample> <para> - You also can use the <literal>@</literal> operator to - <emphasis>mute</emphasis> errors occuring in the constructor, e.g. + ÄãÒ²¿ÉÒÔʹÓà <literal>@</literal> ²Ù×÷·ûÀ´ <emphasis>Ïû³ý</emphasis> ·¢ÉúÔÚ¹¹Ô캯ÊýÖеĴíÎó¡£e.g. <literal>@new</literal>. + </para> <caution> <simpara> - In PHP 3, derived classes and constructors have a number of - limitations. The following examples should be read carefully - to understand these limitations. + PHP 3£¬ÅÉÉúÀàºÍ¹¹Ô캯ÊýÓÐÐí¶àÏÞÖÆ¡£×ÐϸÔĶÁÏÂÁз¶ÀýÒÔÀí½âÕâЩÏÞÖÆ¡£ </simpara> </caution> @@ -369,17 +340,13 @@ </informalexample> <para> - In PHP 3, no constructor is being called in the above example. - The rule in PHP 3 is: 'A constructor is a function of the same - name as the class.'. The name of the class is B, and there is - no function called B() in class B. Nothing happens. + PHP 3£¬ÔÚÉÏÃæµÄʾÀýÖн«²»»áÓй¹Ô캯Êý±»µ÷Óá£PHP 3 µÄ¹æÔòÊÇ£º¡°¹¹Ô캯ÊýÊÇÓëÀà + ͬÃûµÄº¯Êý¡±¡£ÕâÀÀàµÄÃû×ÖÊÇ B£¬µ«ÊÇÀà B ÖÐûÓк¯Êý B()¡£Ê²Ã´Ò²²»»á·¢Éú¡£ </para> <para> - This is fixed in PHP 4 by introducing another rule: If a class - has no constructor, the constructor of the base class is being - called, if it exists. The above example would have printed - 'I am the constructor of A.<br>' in PHP 4. + PHP 4 ÐÞÕýÁËÕâ¸öÎÊÌ⣬²¢½éÉÜÁËÁíÍâµÄйæÔò£ºÈç¹ûÒ»¸öÀàûÓй¹Ô캯Êý£¬Èç¹û¸¸ÀàÓй¹Ôì + º¯ÊýµÄ»°£¬¸¸ÀàµÄ¹¹Ô캯Êý½«»á±»µ÷Óá£PHP 4 ÖУ¬ÉÏÃæµÄÀý×Ó½«»áÊä³ö¡°I am the constructor of A.<br>¡±¡£ </para> <informalexample> @@ -414,43 +381,40 @@ </informalexample> <para> - In PHP 3, the function B() in class A will suddenly become a - constructor in class B, although it was never intended to be. - The rule in PHP 3 is: 'A constructor is a function of the same - name as the class.'. PHP 3 does not care if the function is - being defined in class B, or if it has been inherited. + Èç¹ûÊÇ PHP 3£¬A ÀàÖеĺ¯Êý B() ½«Á¢¼´³ÉΪÀà B ÖеĹ¹Ô캯Êý£¬ËäÈ»²¢²»ÊÇÓÐÒâÈç´Ë¡£ + PHP 3 ÖеĹæÔòÊÇ£º¡°¹¹Ô캯ÊýÊÇÓëÀàͬÃûµÄº¯Êý¡±¡£PHP 3 ²¢²»¹ØÐĺ¯ÊýÊDz»ÊÇÔÚ B Àà + Öж¨ÒåµÄ£¬»òÕßÊÇ·ñÒѾ±»¼Ì³Ð¡£ </para> <para> - This is fixed in PHP 4 by modifying the rule to: 'A constructor - is a function of the same name as the class it is being defined - in.'. Thus in PHP 4, the class B would have no constructor function - of its own and the constructor of the base class would have been - called, printing 'I am the constructor of A.<br>'. + PHP 4 ÐÞ¸ÄÁ˹æÔò£º¡°¹¹Ô캯ÊýÓ붨ÒåÆä×ÔÉíµÄÀàͬÃû¡±¡£Òò¶øÔÚ PHP 4 ÖУ¬Àà B ½« + ²»»áÓÐÊôÓÚ×ÔÉíµÄ¹¹Ô캯Êý£¬²¢ÇÒ¸¸ÀàµÄ¹¹Ô캯Êý½«»á±»µ÷Ó㬴òÓ¡³ö + ¡°I am the constructor of A.<br>¡±¡£ + + [ÒëÕß×¢,by Verdana: ÕâÀïËÆºõÓÐÎÊÌ⣬ʵ¼ÊÊä³öµÄ½á¹û£¬²¢²»ÏóÕâÀï˵µÄÄÇÑù¡£Êµ¼ÊÊä³öµÄ + ÄÚÈÝÊÇ¡°I am a regular function named B in class A......¡±£¬Êä³öµÄÊÇ B() µÄÄÚÈÝ + Ò²¾ÍÊÇ˵£¬Àý×ÓÖеÄ×¢ÊÍ¡°This will call B() as a constructor¡±ÊÇÕýÈ·µÄ¡£Èç¹û´Ó A Àà + ÖÐÒÆ³ýº¯Êý B()£¬ÄÇô½«Êä³ö A() µÄÄÚÈÝ¡£] </para> <caution> <simpara> - Neither PHP 3 nor PHP 4 call constructors of the base class - automatically from a constructor of a derived class. It is - your responsibility to propagate the call to constructors - upstream where appropriate. + ²»¹ÜÊÇ PHP 3 »¹ÊÇ PHP 4 ¶¼²»ÄÜ´ÓÅÉÉúÀàµÄ¹¹Ô캯ÊýÖÐ×Ô¶¯µ÷ÓûùÀàµÄ¹¹Ô캯Êý¡£ + It is your reponsibility to prapagater the call to constructors + upstream where appropriate. </simpara> </caution> <note> <simpara> - There are no destructors in PHP 3 or PHP 4. You may use - <function>register_shutdown_function</function> instead - to simulate most effects of destructors. + PHP 3 »òÕß PHP 4 Öж¼Ã»ÓÐÎö¹¹º¯Êý¡£Äã¿ÉÒÔʹÓà <function>register_shutdown_function</function> + º¯ÊýÀ´Ä£Äâ¶àÊýÎö¹¹º¯ÊýµÄЧ¹û¡£ </simpara> </note> <para> - Destructors are functions that are called automatically - when an object is destroyed, either with <function>unset</function> - or by simply going out of scope. There are no destructors - in PHP. + µ±¶ÔÏó±»Ïú»Ù£¬Ê¹Óà <function>unset</function> »òÕß¼òµ¥µÄÍÑÀ뷶Χ£¬Îö¹¹º¯Êý¶¼»á×Ô¶¯µ÷Óᣠ+ µ« PHP ÖÐûÓÐÎö¹¹º¯Êý¡£ </para> </sect1> @@ -459,15 +423,13 @@ <caution> <simpara> - The following is valid for PHP 4 only. + ÏÂÁÐÄÚÈݽöÔÚ PHP 4 ÖÐÓÐЧ¡£ </simpara> </caution> <para> - Sometimes it is useful to refer to functions and variables - in base classes or to refer to functions in classes that - have not yet any instances. The :: operator is being used - for this. + ÓÐʱ£¬ÔÚûÓÐÉùÃ÷ÈκÎʵÀýµÄÇé¿öÏ·ÃÎÊÀàÖеĺ¯Êý»òÕß»ùÀàÖеĺ¯ÊýºÍ±äÁ¿ºÜÓÐÓô¦¡£ + ¶ø :: ²Ù×÷·û¼´ÓÃÓÚ´ËÇé¿ö¡£ </para> <informalexample> @@ -507,36 +469,27 @@ </informalexample> <para> - The above example calls the function example() in - class A, but there is no object of class A, so that - we cannot write $a->example() or similar. Instead we - call example() as a 'class function', that is, as a - function of the class itself, not any object of that - class. + ÉÏÃæµÄÀý×Óµ÷ÓÃÁË A ÀàµÄº¯Êý example()£¬µ«ÊÇÕâÀï²¢²»´æÔÚ A ÀàµÄ¶ÔÏó£¬ + Òò´Ë²»ÄÜÕâÑùÓà $a->example() »òÕßÀàËÆµÄ·½·¨µ÷Óà example()¡£·´¶øÎÒÃÇ + ½« example() ×÷Ϊһ¸öÀຯÊýÀ´µ÷Óã¬Ò²¾ÍÊÇ˵£¬×÷Ϊһ¸öÀà×ÔÉíµÄº¯ÊýÀ´µ÷Óà + £¬¶ø²»ÊÇÕâ¸öÀàµÄÈκζÔÏó¡£ </para> <para> - There are class functions, but there are no class variables. - In fact, there is no object at all at the time of the call. - Thus, a class function may not use any object variables (but - it can use local and global variables), and it may no use - $this at all. + ÕâÀïÓÐÀຯÊý£¬µ«Ã»ÓÐÀàµÄ±äÁ¿¡£Êµ¼ÊÉÏ£¬ÔÚµ÷Óú¯ÊýʱÍêȫûÓÐÈκζÔÏó¡£Òò¶ø + Ò»¸öÀàµÄº¯Êý¿ÉÒÔ²»Ê¹ÓÃÈκζÔÏ󣨵«¿ÉÒÔʹÓþֲ¿»òÕßÈ«¾Ö±äÁ¿£©£¬²¢ÇÒ¿ÉÒÔ¸ù±¾ + ²»Ê¹Óà $this ±äÁ¿¡£ </para> <para> - In the above example, class B redefines the function example(). - The original definition in class A is shadowed - and no longer available, unless you are refering specifically - to the implementation of example() in class A using the - ::-operator. Write A::example() to do this (in fact, you - should be writing parent::example(), as shown in the next - section). + ÉÏÃæµÄÀý×ÓÖУ¬Àà B ÖØÐ¶¨ÒåÁ˺¯Êý example()¡£A ÀàÖÐÔʼ¶¨ÒåµÄº¯Êý example() + ½«±»ÆÁ±Î²¢ÇÒ²»ÔÙÉúЧ£¬³ý·ÇÄãʹÓà :: ²Ù×÷·ûÀ´·ÃÎÊ A ÀàÖÐµÄ example() º¯Êý¡£ + È磺 A::example() £¨Êµ¼ÊÉÏ£¬Äã±ØÐë±àд parent::example()£¬ÏÂÒ»Õ½éÉܸÃÄÚÈÝ¡££© </para> <para> - In this context, there is a current object and it may - have object variables. Thus, when used from WITHIN an - object function, you may use $this and object variables. + ¾Í´Ë¶øÂÛ£¬¶ÔÓÚµ±Ç°¶ÔÏó£¬Ëü¿ÉÄÜÓжÔÏó±äÁ¿¡£Òò¶ø£¬Äã¿ÉÒÔÔÚ¶ÔÏóº¯ÊýµÄÄÚ²¿ + ʹÓà $this ºÍ¶ÔÏó±äÁ¿¡£ </para> </sect1> @@ -545,10 +498,8 @@ <title><literal>parent</literal></title> <para> - You may find yourself writing code that refers to - variables and functions in base classes. This is - particularly true if your derived class is a refinement - or specialisation of code in your base class. + µ±Äã·¢ÏÖ×Ô¼ºÕýÔÚдһЩ·ÃÎÊ»ùÀàµÄ±äÁ¿ºÍº¯ÊýµÄ´úÂëʱ£¬Õâ³ä·Ö˵Ã÷ÁË + ÄãµÄÅÉÉúÀà·Ç³£µÄ¾«Á·¡¢×¨Òµ¡£ </para> <para> @@ -556,11 +507,14 @@ code, you should be using the special name <literal>parent</literal>, which refers to the name of your base class as given in the <literal>extends</literal> - declation of your class. By doing this, you avoid using the + declaration of your class. By doing this, you avoid using the name of your base class in more than one place. Should your inheritance tree change during implementation, the change is easily made by simply changing the <literal>extends</literal> declaration of your class. + + ÄãÓ¦¸ÃÔÚ´úÂëÖÐʹÓÃרÓÃÃû³Æ <literal>parent</literal> Ìæ´ú»ùÀàµÄÃû³Æ£¬ + À´·ÃÎÊ </para> <informalexample> @@ -593,7 +547,7 @@ </sect1> <sect1 id="language.oop.serialization"> - <title>Serializing objects - objects in sessions</title> + <title>ÐòÁл¯¶ÔÏó£»á»°ÖеĶÔÏó</title> <note> <simpara>