/* * Clone.hpp * * Created on: Jan 4, 2011 * Author: heber */ #ifndef CLONE_HPP_ #define CLONE_HPP_ /** \section (Clone Howto) * * Prototypes serves as templates in object creation, i.e. new objects are * created by coping the prototype. Therefore each prototypical type has to * implement a clone() function. * * By inheriting this pattern and implementing the clone function you make * sure that the prototypes, e.g. to be stored in a factory table, can be * safely copied (the factory just calls clone of the prototype) and can * be handed out by the abstract and common interface. * *

Howto class as follows: * * @code * class Prototype1 : * public IPrototype, * public Clone * { * public: * IPrototype clone() * { * ... do something to clone the class ... * }; * }; * @endcode * * \link {See also at ManipulableClones if changes to the * prototype instance can only be accomplished through its constructor. } * */ template class Clone { public: virtual ~Clone() {}; virtual interface* clone() const = 0; }; #endif /* CLONE_HPP_ */