The following code gives a compilation error:
template <typename T> class Base { public: void bar(){}; }; template <typename T> class Derived : public Base<T> { public: void foo() { bar(); }
MISTAKE
Line 12: error: there are no arguments to 'bar' that depend on a template parameter, so a declaration of 'bar' must be available
Why is this error occurring?
c ++ templates
cppcoder
source share