Re: Declaring a property named "private" and ObjC++
Re: Declaring a property named "private" and ObjC++
- Subject: Re: Declaring a property named "private" and ObjC++
- From: Ricky Sharp <email@hidden>
- Date: Tue, 28 Sep 2010 18:51:58 -0500
On Sep 28, 2010, at 6:19 PM, Nick Zitzmann wrote:
> Okay, I tried searching, and didn't find anything pertinent...
>
> How do I create a property for a class named "private" and not have the Objective-C++ compiler trip on it?
>
> Here's what I first tried:
>
> @property(assign,getter=isPrivate) BOOL private;
>
> That @property declaration works just fine when compiling Objective-C code, but when the header is imported into Objective-C++ code, I get the following error twice:
> error: expected unqualified-id before 'private'
>
> I know the word "private" is used as a keyword in C++ to mark the private section of a class. So I tried rephrasing that property declaration to try and get the compiler to treat the word "private" as a property name and not as a C++ keyword. I thought this might work:
Why do you need to use the exact name of "private"? You should never name things using reserved words.
How about simply adding a suffix or prefix?
___________________________________________________________
Ricky A. Sharp mailto:email@hidden
Instant Interactive(tm) http://www.instantinteractive.com
_______________________________________________
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