代码:
#import <Foundation/Foundation.h>
@interface MyClass : NSObject
- (void) funcA;
- (void) funcAA;
+ (void) funcA;
+ (void) funcAA;
@end
@implementation MyClass
- (void) funcA
{
NSLog(@"-funcA");
[self funcAA];
}
- (void) funcAA
{
NSLog(@"-funcAA");
}
+ (void) funcA
{
NSLog(@"+funcA");
[self funcAA];
}
+ (void) funcAA
{
NSLog(@"+funcAA");
}
@end
int main(void)
{
[MyClass funcA];
MyClass* pmc = [MyClass new];
[pmc funcA];
return 0;
}
输出:
+funcA +funcAA -funcA -funcAA
原文:http://my.oschina.net/Xwoder/blog/336535