Class inheritance format question?

I am trying to figure out how to link my function prototype to my actual function using templates. I am very confused on how to do this correctly. Could anyone please help?

prototype:

1
2
3
4
5
6
7
8
template <class T>

class OListType:ListType<T>{

private:
	void insert_item(const T&);
};


Function definition

1
2
  template <class T>
  T OListType<T>::insert_item(const T&)


Last edited on
External linking doesn't work well with templates. What you have here looks fine as long as you put the definition of insert_item in the header file. You also need to use the same return type in both places.
1
2
void insert_item(const T&);
T OListType<T>::insert_item(const T&)
Topic archived. No new replies allowed.