Can I overload an operator in Objective-C?

You can do this now in Swift, a successor to objC. And since Objective-C and Swift are made to work together This could be interesting for you.


No, you can't do this in Objective-C.


Operator overloading is not a feature of Objective-C. If two instances of your classes can be added together, provide a method and allow them to be added using that method:

Thing *result = [thingOne thingByAddingThing:thingTwo];

Or, if your class is mutable:

[thingOne addThing:thingTwo];