TNT Array2D

Hi all,
This is a part of the header file of the TNT 2DArray class:
1
2
3
4
5
6
7
8
9
10
template <class T>
class Array2D
{
-Data
-Many more methods and these two:

T* 	operator[] (int i)
const T* 	operator[] (int i) const

}

I don't understand the difference between the two operators, how can the computer realize the two and overloading them? Can you give me a help?
Thank you very much.
In one, the this pointer is constant. Since it is an implicit first parameter, the two functions can be overloads.
Thank you, Zhuge.
Could you give me an example of the two calls? I am still not so familiar with thinking in C++...
Sure.
1
2
3
4
5
Array2D<int> Array;
const Array2D<int> ConstArray;

Array[0]; // calls the line 7 operator
ConstArray[0]; // calls the line 8 operator 
Thank you very much, I get the point!
Topic archived. No new replies allowed.