I got an assignment to implement a template array class. One of the requirement is to overload the [] operator. I made this two const and non-const version which seems to be working fine.
const T& operator[](const unsigned int index)const
and
T& operator[](const unsigned int index)
My question is how will the compiler know which one to run when i will do something like:
int i=arr[1]
On a non-const array?