diff options
Diffstat (limited to 'include/class.h')
-rw-r--r-- | include/class.h | 14 |
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; |