zoukankan      html  css  js  c++  java
  • Determining Equality of Objects

    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:

      

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

      

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

      

      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:

      

      

  • 相关阅读:
    记账本程序三
    记账本程序二
    记账本程序一
    <<人月神话>>笔记1
    库存管理系统
    Java实现数据库
    第九周作业
    四则运算总结
    java异常处理
    第十周学习进度报告
  • 原文地址:https://www.cnblogs.com/tekkaman/p/3550873.html
Copyright © 2011-2022 走看看