0
我收到一個錯誤,說'T'沒有命名一個類型。我對這意味着什麼感到困惑。我以爲我在課堂上宣稱虛擬T?類型沒有聲明錯誤
template <class T>
class ABList : public ABCList<T> {
private:
T a [LIST_MAX];
int size;
public:
ABList();
virtual bool isEmpty();
virtual int getLength();
virtual void insert (int pos, T item);
virtual T remove (int pos);
virtual T retrieve (int pos);
};
。
T ABList::retrieve (int pos) throw (ListException)
{
if (pos <= 0 || pos >= count)
throw new ListException();
return item[pos – 1];
}
啊所以只是添加模板 –
mystycs
@soniccool:另外,'ABList ::'而不是'ABList ::'。 –
Nawaz
是的,我剛剛得到了哈哈謝謝! – mystycs