#include <polyBase.h>
Public Member Functions | |
Poly * | clone () const |
clone has to return a Poly* to satisfy covariance | |
utility class for building the derived types in a polymorphic heirarchy. Base is the base of the heirarchy. A possible use is as follows:
class MyBase: public PolyBase<int> { static MyBase* create(int); // factory method };
template <int t>=""> class MyClass: public Poly<MyClass, MyBase> { public: int type() const {return t;} };
see also Factory
class for another way of doing this static MyBase* MyBase::create(int t) { switch (t) { case 0: return new MyClass<0>; case 1: return new MyClass<1>; case 2: return new MyClass<2>; default: throw std::runtime_error("unknown class construction requested"); } }
See also descriptor specific poly classes, such as polypack.h