I think siddhants3 although gave a good answer, mis-understood the question by I_Empire. You can do this:
#include <iostream>
using namespace std;
template<typename C>
class A
{
public:
A() { }
template<typename T>
void Print(const T&);
};
template<typename C>
template<typename T>
void A<C>::Print(const T& item)
{
std::cout<<item<<std::endl;
}
int main()
{
A<int> t;
t.Print(3.1415f); //implicitly call t.Print<float>(const float&);
t.Print<unsigned int>(100); //explicitly
return 0;
}
Note the use of two templates, the first is the class and the second is the function. There are explicit rules about specialization, which if you are after I recommend posting another question / reading about them in the standard / or experimenting. But I have given the general case.
Now, you have to be a little careful. As I have written it all in one file, there is no problem BUT if you separate the files, then you are going to have to have either explicit or implicit template instatiation. That means if you have a file, say Aclass.cpp and Aclass.h, which have the code and the defiintion of the class, and you use in in another file say main.cpp. There is no way for the compiler to know that it needs a print<unsigned int> for example. If the code is in the actual definition (e.g. Aclass.h) then there is not problem.
So to get round that is automatically is (a) compiler specific, (b) dramatically increases compile time. So you can just ignore the problem and with a couple of flags to …