STL Child Class Undefined Symbol

Hi all..

I've taken the STL list, and made a child class of it called myList. While I understand that this may not be the best implementation, due to the lack of virutual destructors, I'm playing and learning :).

template <class T>
class myList : public std::list <T>
{
public:

int highestNumber();
int highestLetter();
void output(ostream& outfile);
private:

};

For and example the implentation is like this:

template <class T>
int myList<T>::highestNumber(){
}

The files are myList.hpp and myList.cpp.. Whenever I try and use a functino from myList inside of main.cpp, I get an undefined symbol error..

I am calling in in main like this:

myList <myType>myListings;
int number = myListings.highestNumber();

All normal list functions work fine, like:

myListings.sort();

Any light that someone could shed on this would be greatful.
[1034 byte] By [dwessell] at [2007-11-19 22:48:19]
# 1 Re: STL Child Class Undefined Symbol
Hi all..

I've taken the STL list, and made a child class of it called myList. While I understand that this may not be the best implementation, due to the lack of virutual destructors, I'm playing and learning :).That's like saying "I'm playing and learning about chemistry by mixing ammonia with bleach". In other words, don't do it.
Any light that someone could shed on this would be greatful.
http://www.dev-archive.com/forum/showthread.php?t=250284

Regards,

Paul McKenzie
Paul McKenzie at 2007-11-9 1:04:09 >
# 2 Re: STL Child Class Undefined Symbol
2 things:

1. Don't derive publicly from STL collections.
2. Templates require the implementation in the header. (See Paul McKenzie's link)
NMTop40 at 2007-11-9 1:05:14 >