// ===========================
// = File: SomeClass.m
// ===========================
#import "SomeClass.h"
#import
// =================================
// = Interface for hidden methods
// =================================
@interface SomeClass (hidden)
+(void) hiddenClassMethod;
-(void) hiddenInstanceMethod;
@end
// =====================================
// = Implementation of hidden methods
// =====================================
@implementation SomeClass (hidden)
+(void) hiddenClassMethod
{
printf( "Hidden class method./n" );
}
-(void) hiddenInstanceMethod
{
printf( "Hidden instance method/n" );
}
@end
// ================================
// = Implementation for SomeClass
// ================================
@implementation SomeClass
-(void) msg
{
printf("Inside msg().../n");
[self hiddenInstanceMethod];
[SomeClass hiddenClassMethod];
}
+(void) classMsg
{
printf("Inside classMsg()…/n");
}
@end
Objective-C: Private Methods
最新推荐文章于 2022-09-27 18:05:16 发布