Possible Duplicate:
Why can templates only be implemented in the header file?
Why should the implementation and the declaration of a template class be in the same header file?
I'm a computer science student at some university and we were given files to work on for hw. And I wasn't sure how this kind of instantiation worked.
long code short it looked something like this.
in List.h
#ifndef _LIST_H_
#define _LIST_H_
#include <iterator>
#include <ostream>
template <class T>
class List
/* implementation below but not relevant to this post */
.
.
.
.
....the last few lines of the file below.
#include "list.cpp"
#include "list_given.cpp"
#endif
and List.cpp didn't include List.h
I don't understand how including List.cpp in the header file works.