3 ms·
Doesn't you code assume that there is exactly one derived class, and that the base class knows the name of it?
by im3w1l 10y ago
Doesn't you code assume that there is exactly one derived class, and that the base class knows the name of it?
- Kristine1975 10y agoThe base class must be a template with one parameter being the derived class: template <typename D> class Base { ... }; and then: class Derived: public Base<Derived> { ... }; This is called the https://en.wikipedia.org/wiki/Curiously_recurring_template_pattern https://en.wikipedia.org/wiki/Curiously_recurring_template_p...