here's a templated class implementing a crude templated array. The class needs to be flushed out to make it useful for anything other than demonstrating the syntax of templated class method definitions, so use it as you may:
Code:
template<class T>
class Array
{
public:
T * pT;
int size;
Array();
Array(const Array & rhs);
~Arrray () {delete [] pT;}
//etc.
};
template<class T> Array<T>::Array : size(10)
{
pT = new T[size];
}
template<class T> Array<T>::Array(const Array & rhs)
{
for(int i = 0; i < size; ++i)
pT[i] = rhs.pT[i];
}
int main()
{
Array<int> fb;
}