. , , , . , , . ; , .
--, .
- (, Squeegy ).
, , , , . :
BaseClass.h:
@interface BaseClass
{
};
- someNiftyMethodWith:(NSString *)someCoolParameter;
@end
BaseClass.m:
@implementation BaseClass
- someNiftyMethodWith:(id)someCoolParameter
{
NSLog(@"yoy, that was easy to print %@ into the console", someCoolParamater);
}
@end
ExtendingClass.h
@interface ExtendingClass : BaseClass
{
};
- someMethodThatNeedsHelp;
@end
ExtendingClass.m
@implementation ExtendingClass
- someMethodThatNeedsHelp
{
[self someNiftyMethodWith:@"called by the extending class"];
}
@end
, Objective C. , , .
, : C-, :
Helper.h:
void OldSchoolHelperFunction(void) { printf("simple helper function"); };
Helper.h ,
#import "Helper.h"
@implemenation FooBar
- someMethodThatNeedsHelp
{
OldSchoolHelperFunction();
}
@end