CRTP and multilevel inheritance
(1) The topmost class in the hierarchy looks like: template <typename T> class A { public: void bar() const { // do something and then call foo (possibly) in the derived class: foo(); } void foo() const { static_cast<const T*>(this)->foo(); } protected: ~A() = default; // Constructors should be protected as well. }; A<T>::foo() behaves … Read more