error:
Error: Unresolved external 'Array<int, 6>::~Array<int, 6>()' referenced from C:\DOCUMENTS AND SETTINGS\KELVIN POMPEY\CBPROJECT\ARRAYTEMPLATE\WINDOWS\DEBUG_BUILD \MAIN.OBJ
Code:// Fig. 8.4: array1.h // Simple class Array (for integers) #ifndef ARRAY1_H #define ARRAY1_H #include <iostream> using std::ostream; using std::istream; template <class T, int numberOfElements = 10> class Array { friend ostream &operator<<( ostream &, const Array<T,numberOfElements> & ); friend istream &operator>>( istream &, Array<T,numberOfElements> & ); public: Array<T,numberOfElements>(); // default constructor Array( const Array<T,numberOfElements> & ); // copy constructor ~Array<T,numberOfElements>(); // destructor int getSize() const; // return size const Array<T,numberOfElements> &operator=( const Array<T,numberOfElements> & ); // assign arrays bool operator==( const Array<T,numberOfElements> & ) const; // compare equal // Determine if two arrays are not equal and // return true, otherwise return false (uses operator==). bool operator!=( const Array<T,numberOfElements> &right ) const { return ! ( *this == right ); } T &operator[]( int ); // subscript operator const T &operator[]( int ) const; // subscript operator static int getArrayCount(); // Return count of // arrays instantiated. private: int size; // size of the array T *ptr; // pointer to first element of array static int arrayCount; // # of Arrays instantiated }; #endifAnyone have an idea of what im doing wrong? Just learning about templates but my book doesn't seem doesn't seem to cover the topic comprehensively.Code:#include <iostream> using std::cout; using std::endl; #include "Array1.h" int main( int argc, char * argv[] ) { Array<int, 6 > numbers; return 0; }



LinkBack URL
About LinkBacks


