// Header X.h
template<typename T>
class X
{
public:
void foo(){ /* do something */ }
// more stuff
};
// Header Xint.h
template<typename T>
class X;
template<>
class X<int>
{
public:
void foo();
// more stuff
};
// Source Xint.cpp
#include"Xint.h"
template<>
void X<int>::foo()
{
// do something else
};
// Source main.cpp
#include"Xint.h"
int main()
{
X<int> x;
x.foo();
return 0;
}
End of Listing