Next time,
strcrssd, please also post the error message. It probably told you what your problem is and, if you couldn't understand it, chances are that one of us could have.
By the way, I just copied your code into my compiler (VC++ 6.0) and it compiled just fine. VC++ 6.0 is not the world's most compliant compiler so... what was your error message, again?
Also, there are many improvements to your code that can be made but I'll just name one (other than not
using the
std namespace!). You might want to typedef your containers. Not only will it save you typing but it will also better abstract your containers.
Have you ever wondered why all the STL containers look so similar? It's so that if you were ever to change your mind and decide to use another container, chances are that you can do so and not affect your entire code. However, this will not work if you explicitly declare your type at every insance. So, your class might look like this:
Code:
template<class Object>
class HashTable{
 public:
 typedef List std::list<typename Object>; // newer compilers might need the typename keyword, here...

 HashTable(unsigned long tableSize);
 void insert(unsigned long key, Object p);

 List retrieve(unsigned long key);
 bool retrieve(unsigned long key, List* output); // this is more efficient because you won't copy an entire container...

 protected:
 unsigned long hash(unsigned long key);

 private:
 typedef Table std::vector<List>; // no one needs to know what this is so make it private...

 // unsigned long tableSize; you don't really need this because you'll implicitly store the size in the Table container, table.size()
 Table table;
};
This way, your for() loop will look like this:
Code:
for(int i=0; i<3; i++){
 HashTable::List objList;
 if( ht.retrieve( static_cast<unsigned long>(i), &objList) ){
 for(HashTable::List::iterator i = objList.begin(); i != objList.end(); i++){
 // cout << objList.front().getName() << endl; this is what you used to have
 cout << i->getName() << endl; // this is probably what you wanted...
 }
 }
}
Notice how you can replace
typedef List std::list<typename Object> with
typedef List std::deque<typename Object> and no one would care? All you did to
replace an entire container type throught your entire code was change one line! Hell, you might even go as far as to replace
typedef Table std::vector<List> with
typedef Table boost::hash<typename Object>, if one were to exist, someday...
This is the essence of maintainability...