Possible Duplicate:
Objective-C: Should I declare private methods?
In objective-C I thought that you had to declare a method before calling it, or at least the method implementation had to be before the call to that method in the file. But it seems you can call a method without any prototype declared in the .h or class extension, and regardless of order.
I thought the following would have a problem but it works fine, so I am just wondering is there any need to declare 'private' methods in your class extension?
- (id)init
{
self = [super init];
if (self) {
[self methodA];
}
return self;
}
- (void)methodA
{
NSLog(@"method A");
[self methodB];
}
- (void)methodB
{
NSLog(@"method B");
}