Hello All,
Can you please let me know if we can do pointer arthrmetic using
operator overloading? If not, can you please explain why it's not
supported by compiler?
I tried below e.g. which was giving me error.
typedef class x
{
}X;
void operator +(X *p,X *q)
{
}
main()
{
X *p,*q;
p+q;
}
[/home/dbk/temp_eg]: gcc ptr.cpp
ptr.cpp:5: `operator +(X *, X *)' must have an argument of class or
enumerated type
ptr.cpp: In function `int main()':
ptr.cpp:10: invalid operands `X *' and `X *' to binary `operator +'
Any idea what are these errors?
TIA,
Bharath