I'm having issues accessing template member functions of a template base class from inside a template derived class. I've provided a minimalist example that shows the problem I have.
This code produces the following errorCode:#include <iostream> #include <string> using namespace std; template <class type> class base { public: base (string); virtual void f (type) = 0; protected: void g (type); private: string name; }; template <class type> base<type>::base<type> (string objectname) { name = objectname; } template <class type> void base<type>::g (type value) {} template <class type> class derived : public base<type> { public: derived (string objectname) : base<type>(objectname) {}; private: void f (type data) { base<type>::template g<type>(data); } }; int main () { base<int> *example; string name("example"); example = new derived<int>(name); }
I have no idea what the problem is. Any help would be greatly appreciated.Code:In member function 'void derived<type>::f(type) [with type = int]' 37: instantiated from here 30: error: no matching function for call to 'derived<int>::g(int&)'



LinkBack URL
About LinkBacks


