I have implemented getByte():
unsigned char& operator[](size_t i)
{
...
}
Now I would like to implement the counterpart getDword() that benefits from the already written char& operator:
unsigned int& operator[](size_t i)
{
...
/// call here operator for char& []
...
}
How can I achieve that with C++?
I'd like to do something like:
char c = x[100]; takes 1 char
int d = x[100]: takes 4 char from 100 to 103
I have seen that you can overload operators by return type (const and non const operator). Its about some magic with *this