Correct way to put template classes in files?
What is the correct way to organize files for a templated class with defined functions. I tried the standard .h and .cpp with #include .h, but that caused many compiler errors. What is the correct way?
Template class definitions and the member function bodies need to all be placed in the same header file.
The hackers must have gotten into the system through the hyperlink!!
Invader''s Realm
The hackers must have gotten into the system through the hyperlink!!
Invader''s Realm
of you can name the file whatever.template, and do #include whatever.template at the bottom of your whatever.h file. That hides the implementation at least a little bit.
For all my templated and normal classes, I put the class definition first, then the inlined/template member functions at the end of the class''s definition. This allows me to include headers needed by the template/inlined member functions after the class definition.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement