I am creating my own ArrayList STL class in C++ and now am stuck in a problem. I want to overload the [] or = operator (I'm sorry I don't know which one will be better implementation) such that the value on the right side of = operator gets assigned to the element of the vector accessed by the [] operator.
I have overloaded the [] operator to get the element from the array but don't know how to deal with assignment with it.
Here's the ArrayList class implementation :
template<class T> class ArrayList
{
T* array;
ArrayList() {}
// Implemetation of [] overloading
T& operator[] (int index) {return array[index];}
}