I'm, trying to emulate a Double Dispatch in Objective-C.
I know Objective-C does not support function/method overloading. But can you emulate this?
Any idea.
I'm, trying to emulate a Double Dispatch in Objective-C.
I know Objective-C does not support function/method overloading. But can you emulate this?
Any idea.
You can do it as in C++/C# with 2 single dispatches (aka "visitor" pattern, see https://en.wikipedia.org/wiki/Double_dispatch#Double_dispatch_in_C++ ).
Or you can do it manually with some runtime type checking on the argument (see isMemberOfClass).
In this repo give an example of how to Implement
Double Dispatch
inObjective-C