Template class files

May 5, 2017 at 6:14pm
Hello everyone,
I'm trying to write a template class but I didn't understand how .h and .cpp files are to be managed. Where should the implementations and declarations be? Do I have to create both .h and .cpp files?
Thank you in advance
May 5, 2017 at 6:20pm
all of class template goes into the .h file. The only thing that goes into .cpp file are static data members (until C++17, which makes it possible to define those inline too) and non-inline non-template functions that you're calling from the members of the template (if any)
May 5, 2017 at 6:24pm
Thank you for the very fast reply!
Last edited on May 5, 2017 at 6:55pm
Topic archived. No new replies allowed.