我的Objective-C代码有问题.我试图打印出从我的"Person"类创建的对象的所有细节,但是在NSLog方法中不会出现名字和姓氏.它们被空格所取代.
Person.h:http ://pastebin.com/mzWurkUL Person.m:http://pastebin.com/JNSi39aw
这是我的主要源文件:
#import <Foundation/Foundation.h>
#import "Person.h"
int main (int argc, const char * argv[])
{
Person *bobby = [[Person alloc] init];
[bobby setFirstName:@"Bobby"];
[bobby setLastName:@"Flay"];
[bobby setAge:34];
[bobby setWeight:169];
NSLog(@"%s %s is %d years old and weighs %d pounds.",
[bobby first_name],
[bobby last_name],
[bobby age],
[bobby weight]);
return 0;
}
Run Code Online (Sandbox Code Playgroud)