ok thx, you mean template <class T> class Temp{..}
No, that's not what I meant, necessarily.
You need to think about what it is that you actually want to template. Do you want each temp object to be templated on a type? Or do you just want to be able to call the func method with arguments of different types? From what you've shown us of your code, you seem to want the latter, which means you only need the method to be templated, not the whole class.
Another solution is to keep the implementation separated,
The important bit you missed out from that quote is:
and explicitly instantiate all the template instances you'll need:
And, yes, that's not very elegant. Plus, it assumes that the library containing the template can "know" all the different types that the template is going to be used with.
Sorry i'm getting very confused, what should my code look like suppose I only want to make func a template? In what file and what about the explicit instantiaton. I get a lot of compiler errors here