#import<Foundation/Foundation.h>
@interface Animal : NSObject {
int _leg;
int _eye;
}
+(void) Run ;
+(void) eat ;
-(void) setLeg : (int)leg ;
-(void) setEye : (int)eye ;
@end
@implementation Animal
+(void) Run{
NSLog(@"跑了........");
}
+(void) eat{
NSLog(@"吃了.......");
}
-(void) setLeg : (int)leg{
_leg = leg ;
}
-(void) setEye : (int)eye {
_eye = eye ;
}
@end
@interface Dog : Animal
+(void)kanMen;
+(void)Bite;
@end
@implementation Dog
+(void)kanMen{
NSLog(@"狗开门了........");
}
+(void)Bite{
NSLog(@"狗咬人了.........");
}
@end
@interface Cat : Animal
+(void)Climb;
@end
@implementation Cat
+(void)Climb{
NSLog(@"猫爬树了.....");
}
@end
int main(){
[Dog Run];
[Cat Run];
[Dog eat];
[Cat eat];
[Dog kanMen];
[Dog Bite];
[Cat Climb];
return 0;
} |
|