Archived

This topic is now archived and is closed to further replies.

DanG

Correct way to put template classes in files?

Recommended Posts

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?

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
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.

Share this post


Link to post
Share on other sites