Re: @property and automatic synthesis of getters and setters.
Re: @property and automatic synthesis of getters and setters.
- Subject: Re: @property and automatic synthesis of getters and setters.
- From: Aaron Montgomery <email@hidden>
- Date: Thu, 12 Sep 2013 14:52:46 -0700
On Sep 12, 2013, at 2:45 PM, Peter Teeson <email@hidden> wrote:
> Xcode 4.6.2 Lion 10.7.5
> Programming with Objective-C seems to indicate I can do this:
> #import <Cocoa/Cocoa.h>
> #import "Cell.h" //My sub-class
>
> @interface Document : NSDocument
> @property Cell *protoCell;
> @end
>
> and this (i.e. no need to @synthesize):
>
> @implementation Document
> - (id)init
> {
> self = [super init];
> if (self) {
> protoCell = [[Cell alloc]init];
> // Add your subclass-specific initialization here.
> }
> return self;
> }
> ……
> @end
>
> but the compiler tells me
> Use of undeclared identifier 'protoCell'; did you mean '_protoCell'?
I think it is either
_protoCell = [[Cell alloc] init];
or
self.protoCell = [[Cell alloc] init];
_______________________________________________
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