Amazon.com Widgets isEqual
Welcome, Guest. Please login or register.
Did you miss your activation email?
May 18, 2013, 05:15:37 PM
Home Help Search chat Login Register   
News: Read this please.The Great Kangaroo Escape Looking for reviews of the 4th ed on Amazon!   Twitter:  @skochan
                     

+  Official Forum for Programming in Objective-C (the iPhone Programming Language) - Stephen Kochan
|-+  Old Stuff
| |-+  Answers to Exercises
| | |-+  Chapter 15
| | | |-+  isEqual
Pages: [1]   Go Down
Print
Author Topic: isEqual  (Read 459 times)
Thief667
Newbie
*
Posts: 9






« on: March 08, 2011, 01:05:22 AM »

Is there a way to write this line with out using the dot operator?

[theCard.card objectAtIndex: FIRSTNAME]

theCard = object
card = NSMutableArray
FIRSTNAME = element 0

Sample Code:


-(BOOL) isEqual:(AddressCard *) theCard
// Overriding the "isEqual: method which is inherited from NSObject
// See "removeCard" method in AddressBook class for more detail.
{
   if ([[card objectAtIndex: FIRSTNAME] isEqualToString: [theCard.card objectAtIndex: FIRSTNAME]] == YES &&
      [[card objectAtIndex: LASTNAME] isEqualToString: [theCard.card objectAtIndex: LASTNAME]] == YES)
      return YES;
   else
      return NO;

}
Logged
skochan
Administrator
Hero Member
*****
Posts: 3103







« Reply #1 on: March 08, 2011, 09:15:44 AM »

No, there's no way to do that.  Anyway, the objectAtIndex: method is not a property of an array.  The dot operator was not intended to be for non-propertiies, even though it will work for methods that take no arguments (e.g., myFract.release);

Cheers,

Steve
Logged
Thief667
Newbie
*
Posts: 9






« Reply #2 on: March 08, 2011, 08:42:40 PM »

Anyway, the objectAtIndex: method is not a property of an array.  The dot operator was not intended to be for non-propertiies,

When you say property do you mean because objectAtIndex is not an instance variable/element of the card array?

In the @interface I included the line:

@property (copy, nonatomic) NSMutableArray *card;

Is this even correct/proper syntax?

I'm sorry I'm having a brain fart here (i should step away from the Mac for an hour to clear mind but I'm stubborn like that); Could you explain what you mean by property.

Thanks
Logged
Pages: [1]   Go Up
Print
Jump to:  



Login with username, password and session length

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Entire forum contents (c) 2009 classroomM.com. All rights reserved.