I'm new to using templates and they seem to be angry at me.
I'm just assuming my problem is with the template, because I'm not new to classes and I cant see why my class would be spazzing on me (and this isnt all of the code either).
I get an error before :: in the constructor definition, and a bunch of places afterwards. Do I have to declare the template before functions of the class too? or put the class declaration in a .h and put definitions in the .cpp?Code:#include <iostream> typedef unsigned short int USHORT; template< class Datatype > class Array { private: Datatype* m_array; USHORT m_size; public: Array (USHORT); ~Array (); }; Array::Array (USHORT p_sizeInitial) { m_array = new Datatype[p_sizeInitial]; m_size = p_sizeInitial; } Array::~Array () { if (m_array != 0) delete[] m_array; m_array = 0; }
Whats going on!



LinkBack URL
About LinkBacks



