• 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: objectifying a struct
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: objectifying a struct


  • Subject: Re: objectifying a struct
  • From: Daniel Jalkut <email@hidden>
  • Date: Sat, 4 Feb 2006 20:19:24 -0500

Keith - you can declare a public section in your ObjC class and then access them "C-style." Just stick a "@public" at the beginning of your interface. The strategy will basically be the same as you described for C++:

@interface MyObject : NSObject
{
@public
	int	myYuckyPublicIVar;
}

Now you can do this:

MyObject* yuckyObj = [[MyObject alloc] init];
yuckyObj->myYuckyPublicIVar = 666;

Daniel

On Feb 4, 2006, at 7:37 PM, Keith Ray wrote:

It seems like changing the "struct" declaration to an "interface"
declaration immediately breaks a lot of code because the member
variables immediately become private, but it has to be done earlier
than in C++, in order to declare "init" and other methods.

_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: objectifying a struct
      • From: Keith Ray <email@hidden>
References: 
 >objectifying a struct (From: Keith Ray <email@hidden>)

  • Prev by Date: Re: x86 programs on linux?
  • Next by Date: Re: Starting in Cocoa and a bit lost !
  • Previous by thread: objectifying a struct
  • Next by thread: Re: objectifying a struct
  • Index(es):
    • Date
    • Thread