summaryrefslogtreecommitdiff
path: root/include/class.h
diff options
context:
space:
mode:
authorEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2014-03-12 12:35:14 +0100
committerEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2014-03-12 12:35:14 +0100
commitf8775b64f67cc464e024cf79cd98eed30c659d25 (patch)
treee38670c0a68d8fcc8e4e9d819c0a2fb2c27659d9 /include/class.h
parent147f9395449db7fcb32957ae840017cff2740831 (diff)
implemented magic __compare() method
Diffstat (limited to 'include/class.h')
-rw-r--r--include/class.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/include/class.h b/include/class.h
index 6bcefda..eabcec6 100644
--- a/include/class.h
+++ b/include/class.h
@@ -185,6 +185,22 @@ private:
}
/**
+ * Compare two objects
+ * @param object1
+ * @param object2
+ * @return int
+ */
+ virtual int compare(Base *object1, Base *object2) const override
+ {
+ // cast to the actual implementation type
+ T *t1 = (T *)object1;
+ T *t2 = (T *)object2;
+
+ // compare the two objects
+ return t1->__compare(*t2);
+ }
+
+ /**
* Namespaces have access to the private base class
*/
friend class Namespace;