29template <
typename T>
class Array {
Exception thrown when trying to access an element outside the array bounds.
virtual const char * what() const
Returns the exception message.
A template class that represents a dynamic array.
T & operator[](unsigned int index)
Subscript operator for non-const access.
Array(unsigned int n)
Constructor with size. Creates an Array of n elements.
unsigned int size() const
Returns the number of elements in the Array.
Array & operator=(Array other)
Assignment operator. Replaces the contents with a copy of another Array.
const T & operator[](unsigned int index) const
Subscript operator for const access.
~Array()
Destructor. Frees the allocated memory.
Array(const Array &other)
Copy constructor. Creates a deep copy of another Array.
Array()
Default constructor. Creates an empty Array.
void printElement(const T &element)
Prints an element to the standard output.