#import <Foundation/Foundation.h>
@interface Animal : NSObject
- (void)test1;
+ (void)test1;
@end
@implementation Animal
- (void)test1
{
NSLog(@"--test1");
}
+ (void)test1
{
NSLog(@"++test1");
}
@end
@interface Dog : Animal
- (void)test3;
@end
@implementation Dog
- (void)test3
{
NSLog(@"--test3");
[super test1];
}
@end
int main()
{
Dog *dog = [Dog new];
[dog test1];
[dog test3];
return 0;
}
*/
输出记过:Dog-test1
: Animal-test1
: Dog-test3
我老感觉应该是Dog-test3在Animal-test1的前面呀!!! |
|