Re: I Never get 'self' in Obj-C
Re: I Never get 'self' in Obj-C
- Subject: Re: I Never get 'self' in Obj-C
- From: Bill Cheeseman <email@hidden>
- Date: Mon, 05 May 2008 20:20:02 -0400
- Thread-topic: I Never get 'self' in Obj-C
on 2008-05-05 6:55 PM, J. Todd Slack at email@hidden
wrote:
> Does anyone have an example of how to put Obj-C (like an NSStatusItem)
> in with C?
When you implement a function outside of an Objective-C class, but you want
the function to have access to things that are inside the class, you can
pass the class object into the function as a parameter. When you call the
function from inside the class, you pass 'self' in the parameter. 'Self' is
just a pointer, after all; you might have to type it as void* in the
function parameter. I name the parameter 'self' in my code, so that the
function feels like it's a method implemented inside the class, but you
could name it anything.
--
Bill Cheeseman - email@hidden
Quechee Software, Quechee, Vermont, USA
www.quecheesoftware.com
PreFab Software - www.prefabsoftware.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