Amazon.com Widgets setOrigin question
Welcome, Guest. Please login or register.
Did you miss your activation email?
May 23, 2013, 09:33:10 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
| |-+  Chapter Study
| | |-+  Chapter 8 - Inheritance
| | | |-+  setOrigin question
Pages: [1]   Go Down
Print
Author Topic: setOrigin question  (Read 600 times)
iseeumhmm
Newbie
*
Posts: 7






« on: November 01, 2011, 03:37:04 PM »

Very confused about something that probably seems simple to some.

HOW is  setOrigin called by using myRect.origin?

I've read through all the answers on this subject and the answer is always that it's short form. I don't understand.  How does the .origin call setOrigin?  Where is the connection?  

I'm just not able to connect the dots here, is it something to do with argument passing?  Or does the compiler just scour the methods looking for one that sets 'origin'?

I could move forward and take it for granted that it's just short form but I really want to comprehend this

I'm really enjoying this endevor just a little hung up here Smiley

thanks in advance,

Rick
« Last Edit: November 01, 2011, 03:43:24 PM by iseeumhmm » Logged
skochan
Administrator
Hero Member
*****
Posts: 3104







« Reply #1 on: November 01, 2011, 06:13:45 PM »

Please check pp. 129-130 in the 3rd edition.  There's a simple mapping between the dot operator and the method names.

Post back here if it's still not clear.

Cheers,

Steve
Logged
dalburns
Newbie
*
Posts: 8


Email




« Reply #2 on: March 11, 2012, 12:26:21 PM »

Dal here.  I'm also stuck on this point. I have the 4th edition in front of me. I used to know 'C" many years ago and I am totally new to OOP.

I do not understand how the statement, "myRect.origin = myPoint;" can invoke the "setOrigin" method.

My assumptions are that:
setOrigin places a pointer address to the XYPoint instance
origin is an accessor that returns the value of that pointer address
myRect.origin.x is dereferencing to the variable x

In simple steps, please, I'd appreciate an explanation of how the setOrigin method is invoked.

Thx.
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.