I am developing a template class policy that should handle pointers to other classes.
template <class P> class Policy { private: const P *state; public: Policy (P const* s) : state(s){}; };
It works great. Now I want to inherit from the above template class and create new subclasses:
class Greedy : public Policy<???> { public: template <typename P> Greedy (P const* s) : Policy(s) {}: }; class Explora : public Policy<???> { public: template <typename P> Explora (P const* s) : Policy(s) {}: };
The problem is that when defining these classes I do not know what type they will use for the base template. Can this be done? I want to get the type obtained from the inherited class constructor (probably template), and then pass it to the construtor base class. I can do it? If so, how? typedefining enums? I saw this question , but, in my opinion, it really does not answer the question.
c ++ inheritance class templates
Γlex
source share