Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8931969
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T09:14:05+00:00 2026-06-15T09:14:05+00:00

I have two classes where both of them have protocols to be implemented. Can

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T09:14:06+00:00Added an answer on June 15, 2026 at 9:14 am

    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

    @protocol ClassAProtocol;
    @interface ClassA:NSObject
    @property(nonatomic, assign) id<ClassAProtocol> delegate;
    @end
    @protocol ClassAProtocol <NSObject>
    -(void)classA:(ClassA*)classa didSomething:(id)object;
    @end
    
    @implementation ClassA
    -(void)classAFinishedSomething{
        [self.delegate classA:self didSomething:nil];
        [(ClassB*)self.delegate doSomething];
    }
    
    @end
    

    Class B

    @interface ClassB : NSObject<ClassAProtocol>
    -(void)doSomething;
    @end
    @implementation ClassB
    -(void)doSomething{
    
    } 
    -(void)classA:(ClassA*)classa didSomething:(id)object{
    
    }
    @end
    

    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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two classes and both of them uses some of the other class,
I have two classes, one that inherits from the other. The base class is
I have two classes, Class A and Class B, both of them are subclasses
I have two class, A, B in these classes. Both of them I have
If I have two classes that both implement an interface, but also inherit, do
I have two classes (MVC view model) which inherits from one abstract base class.
I have two classes which both extend from SQL class like this: class SQL
I have two classes (let's call them A and B ), both inheriting from
I have two classes, call them A and B. They both contain a Loader
I have two classes, let's call them parent and child, and both need to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.