ex02 fixed
This commit is contained in:
@@ -64,9 +64,9 @@ Array<T>::Array(unsigned int n) : length(n)
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
T &Array<T>::operator[](unsigned int n)
|
||||
T &Array<T>::operator[](int n)
|
||||
{
|
||||
if (n >= length)
|
||||
if (n < 0 || (unsigned int)n >= length)
|
||||
throw std::exception();
|
||||
return (data[n]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user