@implementation Dog
+(void)eat:(NSString *)foodName{
// _age = 10;
[[super new] walk];
NSLog(@"我是dog类,我把animal类的方法重写了");
}
@end
@implementation Animal
+(void)eat:(NSString *) foodName{
NSLog(@"我是动物,我在吃%@",foodName);
[Animal look];
}
+(void)run{
//[super eat];
NSLog(@"我是动物我在奔跑");
}
+(void)look{
NSLog(@"我是私有方法look,我没有声明,但是我被调用了");
}
-(void)walk{
NSLog(@"看我能不能被super调用");
}
|
|