重写系统description

打印模型.png
打印模型林的字段.png
重写系统description.png
- (NSString*)description{

    return [NSString stringWithFormat:@"%@{%@}",[super description],self.name];

}

description到底是什么东西?


description.png

description不是关键字. description是NSObject提供的一个属性

declaration:
@property(readonly, copy) NSString *description;
Description 
Returns a string that describes the contents of the receiver.
This method is used to create a textual representation of an object, for example in a formatted string:
翻译:返回一个描述接收者内容的字符串。
该方法用于创建对象的文本表示,例如在格式化的字符串中:
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容