首页 > 其他 > 详细

Determining Equality of Objects

时间:2014-02-16 13:35:18      阅读:374      评论:0      收藏:0      [点我收藏+]

Determining Equality of Objects

  If you need to determine whether one object is the same as another object, it’s important to remember that you’re working with pointers. The standard C equality operator == is used to test equality between the values of two variables, like this:

  bubuko.com,布布扣

  When dealing with objects, the == operator is used to test whether two separate pointers are pointing to the same object:

  bubuko.com,布布扣

  If you need to test whether two objects represent the same data, you need to call a method like isEqual:, available from NSObject:

  bubuko.com,布布扣

  If you need to compare whether one object represents a greater or lesser value than another object, you can’t use the standard C comparison operators > and <. Instead, the basic Foundation types, like NSNumber, NSString and NSDate, provide a compare: method:

  bubuko.com,布布扣

  

Determining Equality of Objects

原文:http://www.cnblogs.com/tekkaman/p/3550873.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!