I have two classes where both of them have protocols to be implemented.
Can I implement one of the class’s protocol in to the other and vice versa?
Does this cause any run time error?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
But, I dont suppose this is really necessary. Once you have a delegate implemented then you could send a message to the other class as it the same delegate object. I suppose a simple delegate relations as;
Class A
Class B
This will not create a circular reference between the two objects and keep the code clean I suppose. This logic is valid if the delegate is always class B and it respondsToSelector:, the one being sent as a message to class B. But, the above sample posted by matt is mode rigid if you want to have isolate the log between the classes and communicate via standard mechanism.