From 558a383facf4b4a3a3f5a14077bb6d4db92aed07 Mon Sep 17 00:00:00 2001 From: Sara Golemon Date: Thu, 13 Nov 2003 04:53:14 +0000 Subject: [PATCH] Adapt example to not reflect non-existant namespaces. git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@144249 c90b9560-bf6c-de11-be94-00142212c4b1 --- language/oop.xml | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/language/oop.xml b/language/oop.xml index 96ea1680ad..9020de5335 100644 --- a/language/oop.xml +++ b/language/oop.xml @@ -1,5 +1,5 @@ - + Classes and Objects @@ -1159,12 +1159,12 @@ o1 !== o2 : TRUE When using the comparison operator (==), 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. On the other hand, when using the identity operator (===), 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. An example will clarify these rules. @@ -1196,22 +1196,18 @@ class Flag { } } -namespace Other { +class OtherFlag { + var $flag; - class Flag { - 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 @@ compareObjects($o, $p); 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 : FALSE 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