pollita Wed Nov 12 23:53:14 2003 EDT
Modified files: /phpdoc/en/language oop.xml Log: Adapt example to not reflect non-existant namespaces. Index: phpdoc/en/language/oop.xml diff -u phpdoc/en/language/oop.xml:1.45 phpdoc/en/language/oop.xml:1.46 --- phpdoc/en/language/oop.xml:1.45 Tue Sep 30 04:40:06 2003 +++ phpdoc/en/language/oop.xml Wed Nov 12 23:53:14 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.45 $ --> +<!-- $Revision: 1.46 $ --> <chapter id="language.oop"> <title>Classes and Objects</title> @@ -1159,12 +1159,12 @@ When using the comparison operator (<literal>==</literal>), object variables are compared in a simple manner, namely: Two object instances are equal if they have the same attributes and values, and are - instances of the same class, defined in the same namespace. + instances of the same class. </para> <para> On the other hand, when using the identity operator (<literal>===</literal>), object variables are identical if and only if they refer to the same - instance of the same class (in a particular namespace). + instance of the same class. </para> <para> An example will clarify these rules. @@ -1196,22 +1196,18 @@ } } -namespace Other { - - class Flag { - var $flag; +class OtherFlag { + var $flag; - function Flag($flag=true) { - $this->flag = $flag; - } + function OtherFlag($flag=true) { + $this->flag = $flag; } - } $o = new Flag(); $p = new Flag(); $q = $o; -$r = new Other::Flag(); +$r = new OtherFlag(); echo "Two instances of the same class\n"; compareObjects($o, $p); @@ -1219,7 +1215,7 @@ echo "\nTwo references to the same instance\n"; compareObjects($o, $q); -echo "\nInstances of similarly named classes in different namespaces\n"; +echo "\nInstances of two different classes\n"; compareObjects($o, $r); ?> ]]> @@ -1239,7 +1235,7 @@ o1 === o2 : TRUE o1 !== o2 : FALSE -Instances of similarly named classes in different namespaces +Instances of two different classes o1 == o2 : FALSE o1 != o2 : TRUE o1 === o2 : FALSE