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 7529927
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T04:46:15+00:00 2026-05-30T04:46:15+00:00

My idea is very similar to declare a variable of an interface type in

  • 0

My idea is very similar to declare a variable of an interface type in java.

So for example,

header file 1:

@protocol Calculator

@end

I then define an @interface CalculatorImpl which implements the above Calculator protocol.

In header file 2:

@interface SomeViewController : UIViewController {


}

@property (weak, nonatomic) IBOutlet UITextField *txtResult;
@property (weak, nonatomic) Calculator* calculator;

@end

However, the xcode will flag an error at the calculator line

property with 'weak' attribute must be of object type 

Is this usage of protocol disallowed by objective-c?

  • 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-05-30T04:46:17+00:00Added an answer on May 30, 2026 at 4:46 am

    A @protocol isn’t a type so you can’t use it for the type of a @property.

    What you probably want to do instead is this:

    @property (weak, nonatomic) id <Calculator> calculator;
    

    This declares a property with no restriction on its type, except that it conforms to the Calculator protocol.

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

Sidebar

Related Questions

I have a very little idea about what database file system is. Can somebody
I am using very similar code to the Backbone ToDo example - http://documentcloud.github.com/backbone/docs/todos.html .
I have two very similar pieces of ASP.NET code that send a file in
So the idea behind an array and a function are very similar from a
The idea seems to be very similar by keeping actual content separate from the
Basically, Im making a paint application very similar to MSPaint. The idea is that,
I'm developing a control which inherits from a System.Windows.Form.Panel. The idea is very simple:
The idea it's very easy, i have an http download class, this class must
I am very new to python and have no idea what I'm doing but
I am using a very light jquery content slider but have no idea how

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.