• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: protocol and properties
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: protocol and properties


  • Subject: Re: protocol and properties
  • From: Martin Hewitson <email@hidden>
  • Date: Sun, 28 Nov 2010 10:30:20 +0100

On 28, Nov, 2010, at 10:22 AM, Mario Kušnjer wrote:

>
>> 	Then I implement a class which implements this protocol. To do that
> I make a property:
>
>> 	@property (nonatomic, readwrite, retain) NSArray * objects;
>
>> 	and put the appropriate synthesize statement in the implementation.
>
>> 	I get compiler warnings that this class doesn't implement the
> protocol. It seems it doesn't take the synthesized getter as being an
> implementation of the -objects method.
>
>> 	I also tried explicitly adding the implementation, but the warning
> remains:
>
>> 	- (NSArray*) objects
>> 	{
>> 	  return objects;
>> 	}
>
>> 	Am I doing something wrong here, or is it not possible to use a
> property to satisfy a protocol?
>
> Yes, you are doing something wrong.
> Here you are just using a method that you declared and implemented in a
> protocol.
> You need to tell a class where that method is declared and implemented, and
> you do that like this:
>
> @interface ClassIWantToUseSomeProtocolMethodIn : NSObject
> <MyProtocolThatIWantToImplement>
>

Sorry, I am doing that, I just didn't write it in the mail. That's why I get the warnings 'Class doesn't fully implement protocol'.

Cheers,

Martin

> Bye
>
> Mario Kušnjer
>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Martin Hewitson
Albert-Einstein-Institut
Max-Planck-Institut fuer
    Gravitationsphysik und Universitaet Hannover
Callinstr. 38, 30167 Hannover, Germany
Tel: +49-511-762-17121, Fax: +49-511-762-5861
E-Mail: email@hidden
WWW: http://www.aei.mpg.de/~hewitson
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~





_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >protocol and properties (From: Martin Hewitson <email@hidden>)
 >RE: protocol and properties (From: Mario Kušnjer <email@hidden>)

  • Prev by Date: Re: protocol and properties
  • Next by Date: Re: How to encrypt a String to a SHA-1 Encrypted in iPhone
  • Previous by thread: RE: protocol and properties
  • Next by thread: Problem with custom NSTextFieldCell
  • Index(es):
    • Date
    • Thread