首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > Iphone >

iphone开发简单有关问题

2012-05-16 
iphone开发简单问题#import Foundation/Foundation.h@interface Bird:NSObject{}- (void) eat- (void)

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];

热点排行