读书人

iphone开发简单有关问题

发布时间: 2012-05-16 11:12:12 作者: rapoo

iphone开发简单问题
#import <Foundation/Foundation.h>
@interface Bird:NSObject
{


}

- (void) eat;
- (void) sleep;

@end

@implementation Bird

-(void)eat
{
NSLog(@"吃的方法");
}

-(void)sleep
{
NSLog(@"睡的方法");
}

@end

int main(int argc, const char * argv[])
{
//@autoreleasepool {

// insert code here...
NSLog(@"Hello, World!");
id b[0];
b[0]=[Bird new];
[b[0] eat];
//

return 0;
}
程序无法调用eat方法,提示break point求大神指教

[解决办法]
Bird *bird = [[Bird alloc] init];
[bird eat];
[bird release];

读书人网 >Iphone

热点推荐