Once again were back to working on Template classes which I do not understand at all. I have to make a stack by using a dynamic array. This is to be done with a Template Class. Can someone please explain the exact purpose a Template Class serves and distinguish it from a class then give me some help on this project. So far I have the copy constructor, destructor and a constructor. The code for them is pasted below. Can someone please help me or point me to some tutorials on Template Classes on the web. I'm in an advanced level course but when I took the intro course the teacher I had didn't get past chapter 1 (no I'm not joking about that either) so this class is kicking my ass.
template <class Item>
stack <Item>::stack (size_type initial_capacity)
{
data = new value_type [initial_capacity = 5];
capacity = initial_capacity;
used = 0;
}
template <class Item>
Item stack <Item>::stack (const stack& source)
{
data = new value_type [source.capacity];
capacity = source.capacity;
used = source.used;
copy (source.data, source.data + used, data);
}
template <class Item>
Item stack <Item>::~stack ()
{
delete [ ] data;
}