#import <Foundation/Foundation.h>
@interface Person : NSObject
{ @public
NSString *_name;
NSString *_dog;
}
-(void)feed;
-(void)walk;
@end
@implementation Person
-(void)feed{
NSLog(@"彭远洋同学在喂泰迪吃麻辣烫");
}
-(void)walk{
NSLog(@"彭远洋同学在遛狗,狗在前面跑");
NSLog(@"彭远洋同学你确定你在遛狗,不是狗在溜你吗?");
}
@end
int main(){
@autoreleasepool {
Person *p1=[Person new];
[p1 feed];
[p1 walk];
}
return 0;
} |
|