|
From: | Frederic Stark |
Subject: | Re: dia2code objc |
Date: | Wed, 27 Mar 2002 16:43:27 +0100 |
User-agent: | Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:0.9.8) Gecko/20020204 |
Björn Gohla wrote:
On Tuesday 26 March 2002 18:03, Frederic Stark wrote: [...]* public methods are delcared in the main header * protected methods are declared in a separate category (which can be put in its own file) * private methods are declared in a category located at the start of the .m and implemented at the end.i was thinking that too, but that would completely prohibit users from calling the functions in it, perhaps forcing the user to handcraft some ugly workaround should it turn out to be necessary to use the class in ways not forseen by the designer.
It does not prohibits user from calling the functions: Foo.h: @interface Foo : NSObject @end Foo.m: @interface Foo(Private) - (void)privateMethod; - (void)otherPrivateMethod; @end @implementation Foo @end @implementation Foo(Private) - (void)privateMethod { bla bla } - (void)otherPrivateMethod { bla bla } @end The Foo user that want to use the private method only have to do: Bar.m: // Access to Foo private methods @interface Foo(Hack) - (void)privateMethod; @end @implementation Bar - (void)dangerousStuff { [_foo privateMethod]; } @end Nothing too ugly here. Cheers, --fred
[Prev in Thread] | Current Thread | [Next in Thread] |