int main(int argc, const char * argv[])
{
// 分别创建两个人
Person *p1 = [[Person alloc] init];
Person *p2 = [[Person alloc] init];
// 分别创建两个微博
Status *s1 = [[Status alloc] init];
Status *s2 = [[Status alloc] init];
p1.name = @"lisi";
s1.user = p1.name;
s1.text = @"tianqihao";
p2.name = @"wangwu";
p2.sex = sexwoman;
s2.user = p2.name;
s2.text = @"tianqizhende henhao";
s2.restatus = s1.text;
NSLog(@"名字是%@的人,发了微博%@",p1.name,s1.text);
NSLog(@"名字是%@的人,性别是%d,发了微博%@,并转发微博%@",s2.user,p2.sex,s2.text,s2.restatus);
[s2 release];
[s1 release];
[p2 release];
[p1 release];
}
问题:如果是s2.user = p2.name 则XCODE会出现警告,但是如果按照MJ老师的s2.user = p2,则不会打印出姓名的结果,求助求助。
|