How can I overload operator + between two pointers pointing to a new class object ? e.g
class A{
}
A* operator+(A* p1,A*p2){
return A;
}
I'm using objects only with pointers so I need to use pointers.
How can I overload operator + between two pointers pointing to a new class object ? e.g
class A{
}
A* operator+(A* p1,A*p2){
return A;
}
I'm using objects only with pointers so I need to use pointers.
How can i overload operator + between two pointers?
The standard doesn't allow for both parameters to the operator+
to be pointers:
§[expr.add]/1
For addition, either both operands shall have arithmetic or unscoped enumeration type, or one operand shall be a pointer to a completely-defined object type and the other shall have integral or unscoped enumeration type.