In the ASIHTTPRequest documentation, it says:
For more complex situations, or where you want to parse the response in the background, create a minimal subclass of ASIHTTPRequest for each type of request, and override requestFinished: and failWithError:.
So I’ve created a minimal subclass MyRequest that will handle parsing in a background thread. I haven’t overridden ASIHTTPRequestDelegate, so my delegate class implements that protocol. However, those delegate methods pass a ASIHTTPRequest, which is (and I’d like to be treated as) a MyRequest, to take advantage of the new functionality. What’s the right way to handle this with Objective-C’s inheritance rules?
The delegate presumably knows it’s working with a
MyRequest. In that case, it can do a checked cast in the body of the method: