Готовлю защиту по лабораторной работе... не могу понять в чем ошибка: Code: #include <assert.h> #include <iostream> #include "template.h" using namespace std; // ОШИБКА В ЭТИХ СТРОЧКАХ!!! template class ARRAY<int, int, int>; template class ARRAY<double, int, int>; // Конструктор template <class Type, int low, int hight> ARRAY<Type, low, hight>::ARRAY() { // Забиваем массив нулями for( int i = low; i <= hight; i++ ) { arr[i] = 0; } } // Деструктор template <class Type, int low, int hight> ARRAY<Type, low, hight>::~ARRAY(){} // Поместить елемент в массив template <class Type, int low, int hight> void ARRAY<Type, low, hight>::PUT(Type num, int pos) { if( low <= pos && pos <= hight ) { arr[pos] = num; } else cout << "ERROR POSITION!!!" << endl; } // Удалить елемент из массива template <class Type, int low, int hight> void ARRAY<Type, low, hight>::PUSH( int pos ) { if( low <= pos && pos <= hight ) { arr[pos] = 0; } else cout << "ERROR POSITION!!!" << endl; } // Печать массива template <class Type, int low, int hight> void ARRAY<Type, low, hight>::print() const { cout << "Array: \t"; // Выводим массив for (int i = low; i < hight; i++) { cout << "\t" << arr[i] << " "; } cout << endl << "index_x: " << x // Вывод нижней границы << endl << "index_y: " << y // Вывод верхней границы << endl << endl; } // Перегруженная операция индексации template <class Type, int low, int hight> Type &ARRAY<Type, low, hight>::operator[]( int subscript ) { // Проверка ошибочного выхода индекса из диапозона assert( low <= subscript && subscript < hight ); return arr[subscript]; }
та какая разница в чем суть программы... мне надо исправить те две строчки объявления шаблона... Изначально было template class ARRAY<int>; template class ARRAY<double>; и все нормально работала... лабораторку я показал все отлично. на защиту меня попросили немного переделать программку