Official Forum for Programming in Objective-C (the iPhone Programming Language) - Stephen Kochan
September 21, 2017, 03:53:35 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: Are instance variables the input or output from a Class  (Read 1948 times)
CloudDweller
Newbie
*
Posts: 17


« on: February 01, 2012, 06:24:00 PM »

First let me say a big thank you for such a fantastic book.  I'm slowly getting to grips with things but so far it all appears to be sinking in.  The excursive in 3.7 took me a while and I was constantly having to refer back through the chapters to get the syntax right.

Firstly is it okay if I go back over the materials or am I supposed to be able to complete the excursuses without this?  Secondly I have a small question about instant variables and that is.  Are instant variables data that you want to get out of the class or data you put into the class?

Sorry if this is a stupid question but I'm just trying to get my head around it before I push forward.
Logged
skochan
Administrator
Hero Member
*****
Posts: 3114



« Reply #1 on: February 02, 2012, 11:29:09 AM »

First, no questions here are stupid.  And yes, of course, the exercises are designed to cement the material you've learned in the chapter.  So you should refer back to the text as necessary, and not feel bad about doing that.

The instance variables hold the data for an object (more precisely, for an instance from the class).  Sometimes you want to set that data from externally-driven events (e.g., you fill up your tank with gas, so tell the car object to set its gas tank to full).   Other times, you want to retrieve the data back out (e.g., you just drove 50 miles, and you want to know the current odometer reading).

Hope this helps.

Steve
Logged
CloudDweller
Newbie
*
Posts: 17


« Reply #2 on: February 07, 2012, 03:41:59 AM »

That really helps. Thanks.
« Last Edit: February 07, 2012, 03:56:17 AM by CloudDweller » 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.