Amazon.com Widgets Are instance variables the input or output from a Class
Welcome, Guest. Please login or register.
Did you miss your activation email?
April 20, 2014, 05:23:31 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 3 - Classes, Objects, and Methods
| | | |-+ Are instance variables the input or output from a Class
Pages: [1] Go Down
Print
Author Topic: Are instance variables the input or output from a Class (Read 894 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:



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.