• 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: Objective-C & Private functions
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Objective-C & Private functions


  • Subject: Re: Objective-C & Private functions
  • From: Clark Cox <email@hidden>
  • Date: Sun, 8 Feb 2004 14:29:32 -0500

On 2004/02/08, at 13:59, Peter Fischer wrote:

> Hello -
> Is there any way to create private "Helper" functions in
> objective-C? I have not been able to find any information on function
> scoping within a .h file. Obviously, a function can be declared &
> implemented in the .m file, making it somewhat private. However, the
> functions pretty much need to be implemented at the top of the .m file
> so that other functions can see them. Is there a way to declare
> private functions in the .h file, or at the very least, forward
> declare them at the top of a .m file, and provide implementation
> further down in the .m. Thanks for any help in advance.

You can forward declare the functions in the .m file exactly as you
would in the .h file, there is no difference in syntax. Also, if the
function is only to be called from that specific file, it's a good idea
to declare it static, like so:

static void foo(blah);




--
Clark S. Cox III
email@hidden
http://homepage.mac.com/clarkcox3/
http://homepage.mac.com/clarkcox3/blog/B1196589870/index.html

[demime 0.98b removed an attachment of type application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Objective-C & Private functions (From: Peter Fischer <email@hidden>)

  • Prev by Date: Re: Converting wchar_t string to NSString
  • Next by Date: Re: Objective-C & Private functions
  • Previous by thread: Objective-C & Private functions
  • Next by thread: Re: Objective-C & Private functions
  • Index(es):
    • Date
    • Thread