clonable.hpp
Go to the documentation of this file.
1
2#pragma once
3
4#include "memlite/common.hpp"
5
6namespace by {
7
12 class _nout clonable {
13 BY_ME(clonable)
14 BY_INIT_META(me)
15
16 public:
17 virtual ~clonable() {}
18
19 virtual me* clone() const = 0;
20
21 virtual me* cloneDeep() const {
22 me* ret = clone();
23 ret->onCloneDeep(*this);
24 return ret;
25 }
26
27 virtual void onCloneDeep(const me& from) {}
28 };
29}
Interface for objects that can be cloned.
Definition: clonable.hpp:12