#include #include template class Array { private: T data[10]; int size; public: Array(int sz = 10) : size(sz) {} // Overloaded subscript operator for accessing array elements T& operator[](int index) { if (index < 0 || index >= size) { cout << "Array index out of bounds"; return data[0]; // Return a default value or handle the error gracefully } return data[index]; } // Function to sort the array elements void sort() { for (int i = 0; i < size - 1; ++i) { for (int j = 0; j < size - i - 1; ++j) { if (data[j] > data[j + 1]) { T temp = data[j]; data[j] = data[j + 1]; data[j + 1] = temp; } } } } };