Official Forum for Programming in Objective-C (the iPhone Programming Language) - Stephen Kochan
October 17, 2018, 08:42:00 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register Chat  
Pages: [1]   Go Down
  Print  
Author Topic: NSComparisonMethods  (Read 2602 times)
Bertus
Newbie
*
Posts: 20


'Audaces fortuna iuvat'


WWW Email
« on: April 30, 2014, 06:49:55 AM »

In the exercise where we had to implement
Code: (Objective-C)
-(BOOL)isEqual:(id) object

why does:
Code: (Objective-C)
[object numerator]
work well, while:
Code: (Objective-C)
object.numerator
throws an error in X-code?
Logged
BrianLawson
Sr. Member
****
Posts: 262


Email
« Reply #1 on: April 30, 2014, 07:53:29 AM »

Code: (Objective-C)
[object numerator]
sends the numerator message to the object instance while
Code: (Objective-C)
object.numerator
is trying to access the ivar numerator from the class that object belongs to. Do you have a numerator property? Can you post more of your code along with the error message you are seeing?
Logged
kotyara
Newbie
*
Posts: 15


« Reply #2 on: December 14, 2014, 11:08:20 AM »

I had the same problem. The thing is that you cannot use the dot operator with id variables (Chapter 9).
Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  

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 ゥ 2009 classroomM.com. All rights reserved.