Your teacher wants you to implement a template class. The thing about templates is that they need to get instantiated with the correct template type, which means that you can't create the binary before you know what type its gonna be. That is why the implementation is usually written inside the header file. Have a look f.e. here...
If you are new to templates, just ask uncle google or ant wiki ;)
ADD:
To put it simply... when you have something in foo.cpp
, it gets translated to binary and the corresponding header foo.hpp
serves as a reference to what functions are there in the binary that I could use from my other code. The important thing is that this binary does not (really) change anymore.
On the other hand templates can't be transformed into the binary, until you know what type it is going to be operating on... If you use the template class once with int
and another time with vector<double>
for template parameter, the resulting binary could be very very different... Therefore you can only compile the code into the binary once you know the type, and therefore you need to pass along the code (inside the header) instead of just function prototypes...
Hope this is clear. It is after all almost 3 o'clock in the morning here.
If not, this should be very comprehensive.