]> git.saurik.com Git - apple/icu.git/blobdiff - icuSources/i18n/measure.cpp
ICU-511.25.tar.gz
[apple/icu.git] / icuSources / i18n / measure.cpp
index 03e6a7cbab947d9d6108f52666dd723ae2127ee5..639de3e6db17ac4aef8eb1e50d2fcb1c7d8dab92 100644 (file)
@@ -1,6 +1,6 @@
 /*
 **********************************************************************
-* Copyright (c) 2004, International Business Machines
+* Copyright (c) 2004-2012, International Business Machines
 * Corporation and others.  All Rights Reserved.
 **********************************************************************
 * Author: Alan Liu
@@ -8,6 +8,8 @@
 * Since: ICU 3.0
 **********************************************************************
 */
+#include "utypeinfo.h"  // for 'typeid' to work
+
 #include "unicode/utypes.h"
 
 #if !UCONFIG_NO_FORMATTING
@@ -48,9 +50,9 @@ Measure::~Measure() {
 
 UBool Measure::operator==(const UObject& other) const {
     const Measure* m = (const Measure*) &other;
-    return getDynamicClassID() == other.getDynamicClassID() &&
-        number == m->getNumber() &&
-        *unit == m->getUnit();
+    return typeid(*this) == typeid(other) &&
+        number == m->getNumber() && 
+        (unit != NULL && *unit == m->getUnit());
 }
 
 //----------------------------------------------------------------------