summaryrefslogtreecommitdiff
path: root/include/class.h
diff options
context:
space:
mode:
authorEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2014-03-04 15:11:46 +0100
committerEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2014-03-04 15:11:46 +0100
commit200952ad4004f6ee5527598622505adbe84df8af (patch)
treea4fb92a86730c771e36abf421835ab01861ef41c /include/class.h
parent59cfe935248918c1151b300eb19496b76ed579a9 (diff)
implemented cloning of objects
Diffstat (limited to 'include/class.h')
-rw-r--r--include/class.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/include/class.h b/include/class.h
index 8bfcad4..7d82441 100644
--- a/include/class.h
+++ b/include/class.h
@@ -139,6 +139,20 @@ private:
}
/**
+ * Construct a clone
+ * @param orig
+ * @return Base
+ */
+ virtual Base *clone(Base *orig) override
+ {
+ // cast to the original object
+ T *t = (T *)orig;
+
+ // construct a new base by calling the copy constructor
+ return new T(*t);
+ }
+
+ /**
* Namespaces have access to the private base class
*/
friend class Namespace;