人类不输出所需的代码

时间:2014-07-14 07:58:11

标签: objective-c lldb

我是客观c编程的新手,我的程序在下面生成,“lldb”,但我不知道为什么。我试过一点点乱,但没有什么真的有帮助。有人可以提供一些帮助吗?

 #import <Foundation/Foundation.h>

@interface Person: NSObject {

    //Field variables
    int weight;
    int age;
}

//The methds along with their return type and arguments (if they need them)
-(void) print;
-(void) setWeight: (int) w;
-(void) setAge: (int) a;
@end

@implementation Person

-(void) print {
    NSLog(@"My age is %i and I weigh %i", age, weight);
}

-(void) setWeight: (int) w {
    weight = age;
}

-(void) setAge: (int) a {
    age = a;
}
@end

int main( int argc, char *argv[]) {

    @autoreleasepool {
        Person *pav;

        pav = [[Person alloc] init];

        [pav setWeight: 145];
        [pav setAge: 19];
        [pav print];
    }

    return 0;

}

0 个答案:

没有答案