Widgets Exercise 2
Welcome, Guest. Please login or register.
Did you miss your activation email?
November 25, 2015, 10:05:07 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
|-+ Programming in Objective-C, 4th edition
| |-+ Exercises
| | |-+ Chapter 9
| | | |-+ Exercise 2
Pages: [1] Go Down
Author Topic: Exercise 2 (Read 1570 times)
Posts: 11

on: June 12, 2012, 05:58:54 AM

What did you all get for an answer to exercise 2?

I think the answer is yes, since the id type can be used to store objects that belong to any class.
Posts: 6


Reply #1 on: June 12, 2012, 10:43:53 PM

One of my concerns was whether the Rectangle shares methods (in name) with the other classes that take as arguments, or return different types than the classes previously assigned to dataValue, but that shouldn't matter here since dataValue is only being set to an instance of an object, and no actual method is being sent to the instance itself.
Posts: 13


Reply #2 on: July 08, 2015, 07:00:39 PM

I wonder if this is one of the situations where just because it "can" doesn't mean that it should. I know the book spoke about the use of static typing and why it is easier, also that consideration should be given to the simplicity of readability. I wonder if since the id type can hold the object as it is initialized just fine if that is isn't recommended. Also I wonder what happens when the dataValue is assigned another object? Does the rectangle simply disappear at that point?
Pages: [1] Go Up
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 All rights reserved.