Re: NSView -subviews ordering?
Re: NSView -subviews ordering?
- Subject: Re: NSView -subviews ordering?
- From: Brock Brandenberg <email@hidden>
- Date: Wed, 29 May 2002 16:26:53 -0500
so you need to put it outside of your @implementation/@end or in an
external file.
You don't need to do that. Why, on earth?!?
I use the same sort function with a couple of NSView subclasses, so I
simply put it in a file that gets included by both rather than
duplicate code.
Of course you *can* do that, no argument (well, presumably you put it
in a file which gets *linked with* both of them, otherwise -- if
include is really what you used to share the code -- you *do*
duplicate).
Correct. Just a normal .h file included and a .c file linked in. No
"inlining" or inclusion of .c files to just save typing :)
Though, I understood your "...you need to put it outside..." as "you
can't have functions inside", which is not true:
void fnc(void) { ... }
....
@implementation Blah
....
void fnc2(void) { ... }
....
@end
Both cases are perfectly all right.
That's good to know. The Obj-C book doesn't really elaborate on this, so
I assumed that only class and instance methods were allowed in an
implementation. If you wanted to access the function from outside of the
class (such as call it from elsewhere), would being within the
@implementation/@end hide the function since it lies within the class'
namespace? What kind of scope does it have when inside the
implementation?
Thanks,
Brock
----- industrial design @ bergdesign.com ------
_______________________________________________
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.