description方法的介绍及重写

Dog  *d = [Dog new];
//查看对象地址
NSLog(@"\n d= %p ",d);//打印的为地址 例:0x1001002e0
//查看对象实例变量的值
NSLog(@"\n %d",[d age]);

//打印d的对象
NSLog(@"\n@=",d); //例 <Dog : 0x1001002e0>
调用了对象的 description方法

  

重写父类的description

-(NSString *)description{
    return @"";  
}

  

 

posted @ 2015-05-13 11:44  王世桢  阅读(346)  评论(0编辑  收藏  举报